No you don't remove it from /wp-includes/post-template.php
. This is a WordPress core file and you should never edit any WordPress core file.
The answer is talking about removing the call of wp_link_pages
function within a template file.
Which template file to edit depends on the theme and the URL you are visiting. Typically it should be /wp-content/themes/<your-active-theme>/single.php
.
But templates can be divided in multiple files and call to wp_link_pages
function may be in any of those template part files.
For example, in twentyseventeen
theme, it can be found on multiple files. For pages
, it's in:
/wp-content/themes/twentyseventeen/template-parts/page/content-page.php:
For posts, it's in:
/wp-content/themes/twentyseventeen/template-parts/post/content-audio.php
/wp-content/themes/twentyseventeen/template-parts/post/content-gallery.php
/wp-content/themes/twentyseventeen/template-parts/post/content-image.php
/wp-content/themes/twentyseventeen/template-parts/post/content-video.php
/wp-content/themes/twentyseventeen/template-parts/post/content.php
If you still cannot find which template file to edit for your currently active theme, you may read this guide to find out.
Read more about WordPress theme template files for posts and pages.
Also, while you remove the wp_link_pages
function call from any template file, make sure you have basic understanding of PHP function calls. Since the function call may involve multiple lines.
Update: How to remove wp_link_pages
pagination from a Genesis Theme:
(Since it's mentioned in the comment that it's the Genesis LifeStyle Pro
Theme)
Themes with Genesis
framework handle pagination differently. With a Genesis Theme, you'll not actually find an explicit call to the wp_link_pages
pagination function in the template files, as it's handled by the Genesis framework.
So in that case, remove the the CODE you used in the question, and instead, use the following CODE:
add_filter( 'the_content', function( $content ) {
remove_action( 'genesis_entry_content', 'genesis_do_post_content_nav', 12 );
return $content . wp_link_pages( array( 'echo' => FALSE ) );
}, -1 );
Now you'll not have the default pagination provided by your Genesis theme.