I know, this question has been asked a lot. I have been through a lot of them already, but my issue seems to be more bespoke.
Initially, I had this issue, but seems to be another issue, therefore I am asking a new question in hopes for a solution.
I am using the WP Download Manager Pro plugin that creates a custom post type wpdmpro
.
So, the crux of my issue seems to be that my pagination in my loop.php
, seems to be connected someone to the default post type and not the custom post type I am using, as in, if I have 0
Posts in my default posts, navigating to /page/2
will not work, but if I have 11
default posts it will, but then /page/3
will not work.
I have 11
wpdmpro
posts and 0
default posts. Therefore, I would expect here, that with 2 posts per page, that I would have 6 pages? Wordpress seems to think differently!
Here is my query
<?php
$category = get_queried_object();
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$args = array(
'orderby' => 'date',
'order' => 'DESC',
'post_status' => 'publish',
'posts_per_page' => 2,
'paged' => $paged,
'post_type' => 'wpdmpro',
'wpdmcategory' => $category->category_nicename,
'tag' => $cat_tag
);
// Query
$wpdmpro_query = new WP_Query( $args );
// The Loop
if( $wpdmpro_query->have_posts() ) : while( $wpdmpro_query->have_posts() ) : $wpdmpro_query->the_post();
?>
<!-- Do stuff -->
<?php endwhile; ?>
<!-- Do stuff if there are no posts -->
endif; wp_reset_postdata(); ?>
So WHY does /page/2
return a 404
when that page SHOULD exist? As mentioned, if I start to add posts to the default post (on the 11th post), then /page/2
seems to work, with the 21st post /page/3/
works, so it has to be linked to that. But why? I clearly define that I am NOT using 'post_type' => 'post',
. So where could this be defined and how can I override it?
Just a few things to add in case they are somehow linked.
In my permalinks settings, I have a custom structure of
/%category%/%postname%/
and my default category base is .
I have tried resetting the permalinks settings, but still getting the 404 page on /page/2
.
In my WP Download Manager Settings, my WPDM Category URL Base
is .
So, with all that my url is.
{domain}/category-name/page/2/
which is returning the 404.
{domain}/category-name/
returns 2 posts of the stated category.
Part of me is concerned this is a configuration issue, mixing a custom post type with custom structure and category base. Someone out there must have had this issue? It seems like this should be very simple, but I cannot for the life of me find a solution, perhaps I am looking in the wrong places?
Any help will be massively appreciated.
Edit:
I have tried to regenerate the permalinks on multiple different occassions to no effect.