Override wp_link_pages pagebreak with filter

Is it possible to have conditional pagebreaks?

For instance, if there is a match in the query string, the first page break of a post is ignored, and the user get's to read two posts in a row before clicking next?

Topic wp-link-pages wp-query filters pagination posts Wordpress

Category Web


So I just found this filter:

the_posts

https://codex.wordpress.org/Plugin_API/Filter_Reference/the_posts

Send it to a function, and the first parameter is the entire post page with the pagebreak.

My plan is to run it through regex, delete the first occurence of the <!--nextpage--> and return it. I'll see if that works

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.