Title: robmarston's Replies | WordPress.org

---

# robmarston

  [  ](https://wordpress.org/support/users/robmarston/)

 *   [Profile](https://wordpress.org/support/users/robmarston/)
 *   [Topics Started](https://wordpress.org/support/users/robmarston/topics/)
 *   [Replies Created](https://wordpress.org/support/users/robmarston/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/robmarston/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/robmarston/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/robmarston/engagements/)
 *   [Favorites](https://wordpress.org/support/users/robmarston/favorites/)

 Search replies:

## Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)

 *   Forum: [Reviews](https://wordpress.org/support/forum/reviews/)
    In reply to:
   [[Tag Selector] Very helpful but not "idiot-proof"](https://wordpress.org/support/topic/very-helpful-but-not-idiot-proof/)
 *  Plugin Author [robmarston](https://wordpress.org/support/users/robmarston/)
 * (@robmarston)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/very-helpful-but-not-idiot-proof/#post-8072985)
 * [@nick6352683](https://wordpress.org/support/users/nick6352683/) thanks for the
   great feedback. While I don’t want to explicitly disable the plugin’s use on 
   custom post types I would love to give the user the option to select which types
   of posts the meta box is available for. As a developer would you prefer this 
   type of customization on it’s own settings page or within the metabox itself?
   Thanks again!
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [404 error on tag/category archive page 2](https://wordpress.org/support/topic/404-error-on-tagcategory-archive-page-2/)
 *  Thread Starter [robmarston](https://wordpress.org/support/users/robmarston/)
 * (@robmarston)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/404-error-on-tagcategory-archive-page-2/#post-7124056)
 * @evanherman it does, I even tried hard-coding it to 2 and testing the second 
   page URL — same result. The strange thing is, the next pagination link shows 
   up on page 1 so it’s definitely realizing there’s a second post that’s available
   to be shown.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [404 error on tag/category archive page 2](https://wordpress.org/support/topic/404-error-on-tagcategory-archive-page-2/)
 *  Thread Starter [robmarston](https://wordpress.org/support/users/robmarston/)
 * (@robmarston)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/404-error-on-tagcategory-archive-page-2/#post-7124052)
 * @evanherman as of PHP 5.4 (I believe) you can use bracket syntax for arrays. 
   I did try reverting it just in case but it had no affect. Good suggestion though!
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [404 error on tag/category archive page 2](https://wordpress.org/support/topic/404-error-on-tagcategory-archive-page-2/)
 *  Thread Starter [robmarston](https://wordpress.org/support/users/robmarston/)
 * (@robmarston)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/404-error-on-tagcategory-archive-page-2/#post-7124048)
 * @evanherman agreed. My code was heavily customized so I figured it wouldn’t do
   anyone any good to have to sift through it but I definitely agree it’s much easier
   to help diagnose the issue(s) if you have something to look at. I’ve included
   some simplified versions of both queries below in case someone experiencing the
   same issue stumbles upon this post. Cat was replaced with tag if the archive 
   was for tags. Here’s a summary of the issue:
 * – Page 1+ of the review (CPT) archive worked as expected (used archive.php).
   –
   Page 1 of the category/tag archive worked, showed correct pagination (used archive.
   php). – Page 2+ of a category/tag archive redirected to the 404 template (used
   archive.php).
 * Original code:
 *     ```
       archive.php
   
       $args = [
         'cat'            => $category,
         'paged'          => get_query_var('paged') ? get_query_var('paged') : 1,
         'posts_per_page' => 1,
         'post_type'      => 'review'
       ];
       query_posts($args);
       if (have_posts()) :
          while (have_posts()) :
             the_post();
                  ...
       ```
   
 * Revised code:
 *     ```
       archive.php
   
       if (have_posts()) :
          while (have_posts()) :
             the_post();
                  ...   
   
       functions.php
   
       function add_custom_types($query) {
         if (is_category() || is_tag() && empty($query->query_vars['suppress_filters'])) {
           $query->set('post_type',[
             'post',
             'nav_menu_item',
             'review'
           ]);
           return $query;
         }
       }      
   
       add_filter('pre_get_posts','add_custom_types');
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [404 error on tag/category archive page 2](https://wordpress.org/support/topic/404-error-on-tagcategory-archive-page-2/)
 *  Thread Starter [robmarston](https://wordpress.org/support/users/robmarston/)
 * (@robmarston)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/404-error-on-tagcategory-archive-page-2/#post-7123994)
 * [@girlieworks](https://wordpress.org/support/users/girlieworks/) reverting my
   custom query_posts call back to the standard loop fixed it. It must’ve been something
   to do with execution order, resetting the main query, etc. I had to add a filter
   to my functions.php file to set post_type to my custom post type but all is working
   as expected now. As others have previous mentioned, taking advantage of the query
   already in motion is always better than writing your own … some have even gone
   so far as to say “Don’t use query_posts!” lol. Anyway, not sure exactly what 
   the root cause was but it’s solved now nonetheless 🙂
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [404 error on tag/category archive page 2](https://wordpress.org/support/topic/404-error-on-tagcategory-archive-page-2/)
 *  Thread Starter [robmarston](https://wordpress.org/support/users/robmarston/)
 * (@robmarston)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/404-error-on-tagcategory-archive-page-2/#post-7123990)
 * [@girlieworks](https://wordpress.org/support/users/girlieworks/) interesting,
   I hadn’t seen that done before. I tried it and sadly it did not work. With a 
   period in the category base field I now get a 404 at [http://example.com/action](http://example.com/action)
   in addition to [http://example.com/category/action](http://example.com/category/action).
   I’m going to try create separate category and tag templates using the standard
   WP loop and see if that helps, I have a sneaking suspicion the query may be the
   issue. I’ll respond with my findings shortly, as always thank you for your help!
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [404 error on tag/category archive page 2](https://wordpress.org/support/topic/404-error-on-tagcategory-archive-page-2/)
 *  Thread Starter [robmarston](https://wordpress.org/support/users/robmarston/)
 * (@robmarston)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/404-error-on-tagcategory-archive-page-2/#post-7123964)
 * [@girlieworks](https://wordpress.org/support/users/girlieworks/) thanks for the
   suggestion, I didn’t think to change the bases back … I just tried it however
   and the same issue still occurs. I forgot to mention in my original post that
   I’ve flushed the rewrite rules/permalinks several times to no avail. Curious 
   if that 4-segment URL structure is supposed to work out-of-the-box? This one’s
   a real head-scratcher.

Viewing 7 replies - 1 through 7 (of 7 total)