404 Error on pagination with WP Query
I have figured out the problem. There was a naming clash between my post type insights and the page name (also insights) which was confusing WordPress. Changing the post type to the singular insight fixed it.
I have figured out the problem. There was a naming clash between my post type insights and the page name (also insights) which was confusing WordPress. Changing the post type to the singular insight fixed it.
At first blush, your code looks solid. Two suggestions: 1) Try putting the longer rewrite rule before the shorter one. It’s possible that the first one is being matched (because it is a subset of the longer one) and then not proceeding to check the longer one. 2) Whenever you modify rewrite rules, you have … Read more
Ok, found the issue. By analizing the generated query, I realized that it rightly searched for current language posts. I’m currently use polylang as the multilingual plugin, and it correctly associate posts with a ‘language’ taxonomy. Now, I had far more 10 project posts but only 10 where of the current language. All fine now.
solved my problem by removing <?php query_posts(‘posts_per_page=3’) ?> and tried limiting posts from Settings->Reading. Thanks
so it was $wp_query->set(‘nopaging’, true); Which was set in a pre_get_posts function. I never thought of searching for this. I’ve added if(!is_admin()){ // code } So it doesn’t run in the admin.
The concept of dividing up a set of posts into a number of “pages” is called Pagination, and is controlled by a number of pagination parameters in a WordPress posts query. The three most relevant (and most commonly used) are: posts_per_page: the number of posts displayed on each page paged: which page of posts is … Read more
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args = array( ‘tag’ => $taxonomy, ‘post_type’ => ‘initiative’, ‘paged’ => $paged, ‘posts_per_page’ => 9, ‘category_name’ => $category, ‘tag__not_in’ => array(15), ‘meta_key’ => ‘initative_weight’, ‘orderby’ => array(‘meta_value_num’ => ‘DESC’, ‘title’ => ‘ASC’), ‘post_status’ => ‘publish’ ); I changed tag__not_in to an array and updated the orderby to be … Read more
I think you misunderstood my linked post. It is a quite overwhelming amount of info (which you should reread as many times), but in short, you should not be using a custom query in place of your main query on the home page or any type of archive page. I do not know why you … Read more
The post_type parameter for WP_Query can accept an array of post types. This would allow you to combine both streams into a single query which should resolve your current dilemma with pagination. $query = new WP_Query( array( ‘post_type’ => array(‘page’,’post’) ) );
You need to set the base properly so the function knows what URL to make the pagination links relative to. Assuming /releases/ is a post type archive, you can try: ‘base’ => get_post_type_archive_link( ‘releases’ ) . ‘%_%’,