add_rewrite_rule and pagination issue

Your first two rewrite rules do not end with $, which indicates that the URL should stop there. So myPage/mySuPage/param1/param2/page/3 would still be matched by the first pattern, because it can just ignored the /page/3 part at the end. The next rewrite rules will then never be used. With my Rewrite analyzer plugin I was … Read more

Custom page-links for paginated posts | wp_link_pages quicktag

This is going to be kind of hackish, but it is possible using an alternate function. Add this to your theme’s functions.php file. function wp_link_pages_titled($args=””) { $defaults = array( ‘before’ => ‘<p>’ . __(‘Pages:’), ‘after’ => ‘</p>’, ‘link_before’ => ”, ‘link_after’ => ”, ‘echo’ => 1 ); $r = wp_parse_args( $args, $defaults ); extract( $r, … Read more

Listing child terms of parent term

When you are on a taxonomy page, you can get the parent from the term being displayed by using the following code with get_queried_object. See get_terms for the objects that are returned $queried_object = get_queried_object(‘term’); $term = $queried_object->parent; To get the taxonomy, you can simply just add $tax = $queried_object->taxonomy; below the code above. This … Read more

How to use pre_get_posts?

Remove all query code from the template and just leave the default loop. In your example code you’re overwriting the query in the template, in the code you pasted in the comments, you’re running an entirely new query. These are both unnecessary when using pre_get_posts. Put your pre_get_posts code in functions.php. You don’t have to … Read more

Pagination on child category returns 404

There are a lot of questions here regarding pagination, it is definitely one of the least understood aspects of how WordPress works internally. To understand why you get 404s, we’ll start by looking at the Action Reference in Codex to see the process WordPress follows for each request. The process begins by loading up the … Read more

Custom Loop Pagination on WordPress

Edit So, the reason that this isn’t working is because you’ve modified the question to specify that this is happening in a custom page template. Since this is the case, you’ll need to use two separate custom queries, and won’t need to bother with filtering the main query via pre_get_posts. The first query will be … Read more