I want to totally disable this functionality from WordPress because I’m implementing my own version of this with Javascript.
When I try to grab all the content in a post via the get_the_content()
or the_content()
it gives me only the first page, since the content has the page breaks. When I use $post->the_content
I get the full post but it’s not formatted with HTML tags. I don’t want to have to add those myself programatically.
So I either need to get all the content already formatted – the way to do this is unknown to me at the moment
or disable wp_page_links()
so it doesn’t paginate my posts.
EDIT – Now that 4.4 is out, you should use the content_pagination
filter. See birgire’s answer below.
You can add formatting to raw post content by applying the content filters directly to $post->post_content
:
echo apply_filters( 'the_content', $post->post_content );
This will bypass pagination by not using the get_the_content
function, which is what the_content
uses internally to retrieve the current page’s content for multipage posts.
You can prevent wp_link_pages
from outputting anything by applying a filter to its output before the function is called and using the __return_empty_string
helper function:
add_filter( 'wp_link_pages', '__return_empty_string' );