I have a function that replaces my shortcode with some content e.g.
function output() {
$output = '<div>In page 1</div>';
$output .= '<!--nextpage-->';
$output = '<div>In page 2</div>';
echo output;
}
add_filter('the_content','output');
But on the webpage, the nextpage tag is not converted to Pagination
Can anyone help ?
Filters should return values, not echo them. If you just echo them, other filters won’t get the chance to work on the values (filters are often chained together).
Try changing
to
Filter functions usually take an argument of the current value to be filtered too, but you may not need it for this test.
If that doesn’t work, it may be that the pagination is done before your filter is called. If that’s the case, you may need to use a lower value than the default 10 for the third (
$priority) argument ofadd_filter(see the codex).