I've bought a wordpress theme. I want to ignore all wp_link_pages functions from theme files. I will write my custom codes.
Is there any way to do it with functions.php
wp_link_pages
has two filters you can use:
The wp_link_pages_args
filter is passed the $args
for wp_link_pages
so you could set echo
to false.
The wp_link_pages
filter is passed the output so you could set the output to nil. Something like this should work:
/**
* Filter the HTML output of page links for paginated posts.
*
* @param string $output HTML output of paginated posts' page links.
* @param array $args An array of arguments.
* @return string $output HTML output of paginated posts' page links.
**/
add_filter('wp_link_pages', 'wpse_218590_hide_wp_link_pages', 10, 2);
function wpse_218590_hide_wp_link_pages( $output, $args )
{
return '';
}
This isn't tested and I only had a quick look at the filters so it may not be 100% correct but it should give you an idea of what to do