I see that there are a lot of similar questions here at WPSE, and I've tried many of the suggestions mentioned trying to solve my problem but with no success.

I have a category called News. In this category I want to run a custom query using WP Query to fetch and display articles, spread out through multiple pages using the plugin WP-PageNavi. I manage to get the plugin to display the links (go back/forward or to a particular page) but when I click on either one I end up with a 404 page.

My permalink settings is "category/post-name/", for example I have "x.com/news/sample-news/. When trying to access let's say "x.com/news/page/2/" it gives me a 404.

Here's the code -

<?php $paged = get_query_var('paged') ? get_query_var('paged') : 1;
$news = new WP_Query( array('category' => 3, 'paged' => $paged, 'posts_per_page' => 4, 'orderby' => 'date', 'order' => 'DESC') );
while ($news->have_posts()) : $news->the_post(); ?>

<?php the_post_thumbnail( array(466,9999), true ) ?>
<h2><?php the_title() ?></h2>
<h4><?php the_date() ?></h4>
<?php the_content() ?>

<?php endwhile; if($news->max_num_pages>1) 
wp_pagenavi( array('query' => $news) );?>

Using these plugins: Advanced Custom Fields, WP-PageNavi

3 Answers 3


This could be a plugin compatibility problem. Have you tried to disable all plugins and see if that solves the problem?

I found this which may also be of help:


  1. Log in to wp-admin and go to permalinks, click save (this should refresh your permalinks).
  2. Check to see if this fixes your permalinks. If not, set to default.
  3. Disable your plugins to remove them out of the equation.
  4. Log into your server via sFTP/SSH/FTP and find your .htaccess file. It should be located in the root of your WordPress install.
  5. Pull the htaccess file down so that you have a local back up. Once you’ve pulled it down, go ahead and delete it from your server.
  6. Go back to wp-admin and visit your permalinks page. try enabling custom permalinks. This should remedy the issue and you can go ahead and reenable your plugins.
  • Paul: Thanks. I set the permalinks to default and deactivated the plugins, and the next/previous standard links for navigating the posts did show up, and worked correctly. However, I tried following the steps you provided and they gave no results. I also tried adding a different permalink structure, like "x.com/content/news/sample-news/". Same thing here. There seems to be a conflict setting up custom permalinks with the latest version of WP and/or WP-NaviPlugin. Also note that my posts are not custom, they are just a regular category. Commented Oct 19, 2011 at 17:33
  • Does the default WP Pagination work? If so, it could be a problem with WP-PageNavi
    – Paul
    Commented Oct 20, 2011 at 8:20
  • Ok, so I narrowed it down to what I believe is the only reason for this error, the permalinks. Using for example "x.com/?cat=3&paged=2" works every time, even with the WP-PageNavi activated and using custom queries. I have no clue as to why my own permalink settings won't work with this. Commented Oct 20, 2011 at 9:58
  • FYI - Got this working by using a plugin called "Category Pagination Fix" - wordpress.org/extend/plugins/category-pagination-fix. Would prefer not to have to install another plugin to solve it though. Commented Oct 20, 2011 at 10:37
  • It's a small function, you could just add it to your functions.php theme file. Glad you solved it!
    – Paul
    Commented Oct 20, 2011 at 13:26

I've had this issue, mine fixed itself when I renamed the page (my page name was the same as my custom post name)

  • This fix does in fact work when the others had not. Commented Aug 23, 2012 at 20:40
  • That was my issue, its actually not the CPT name though its the url rewrite of your CPT so you can't have example.com/article/%postname% if you have your custom query on the page of example.com/article
    – NickFMC
    Commented May 16, 2015 at 5:27

I have also sufer same problem but i've change page-ID.php like (page-81.php) then its work fine with user friendly permalink and WP Version (3.5.1). you may use page-ID on which file you call it instead template-file, but I am using wordpress-posts for blog and wordpress-pages use pages. its not work in other custom content that register from plugin like (CCTM), after an other content like 'testimonials' i just register custom post in my functions.php theme file and then its work fine with pagination and user friendly permalink and removed from custom content plugin (CCTM).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.