Line break page content
-
Hi there,
I am developing an API that its input is post ID. In the API, I want to get the post content. However, if the content has line-break (<!–nextpage–>). How can I get the content of each page?
After researching, I found a function generate_postdata that will return the pages. However, it only supports in 5.2.0. Then I used another function setup_postdata.
My codebase:
if ( function_exists( 'generate_postdata' ) ) { $postdata = generate_postdata( $post ); $pages = $postdata['pages']; } else { setup_postdata( $post ); global $pages; }
Is it the correct way or is there any side effect?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Line break page content’ is closed to new replies.