WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I hope I can explain this properly:

I'm working on a project involving multiple post types and custom permalinks. I have a post type for TV/movie series/franchise and a separate post type for content (episodes, movies, Direct to video). For the content type, I currently have a permalink that is as so:


Thank to the rewrite rules, the structure degrades: I can have archive paves that are just abc.com/watch/%content_series%/%content_type%/ or abc.com/watch/%content_series%/ no problem. The problem I run into is pagination. If I did abc.com/watch/one-piece/page/2, I hit a snag because instead of recognizing that I want page 2, it thinks page is a content_type and 2 is the name.

A screencap of rewrite Analyzer confirms this: enter image description here

So, the right rewrite is there, its just not taking precedence. Is there a way to make this work correctly?

EDIT: Here is the code that sets everything up:

//Query vars/tags   

    $content_struct = get_option('veda_content_slug') . '/%content_series%/%content_type%/%postname%';
    add_permastruct('veda_content', $content_struct, false);    
    add_rewrite_rule(  get_option('veda_content_slug') .'/?$', 'index.php?post_type=veda_content', 'top' ); 
share|improve this question
up vote 1 down vote accepted

I've shared this exact frustration before. The following should help return any lost sanity.

Your first rewrite is pretty loose and is not seeing your second rewrite because 'page' matches your second segment of ([^/]+). The way to fix this is reverse the order of registration within the code. If the paged rewrite is below the looser rule, place it one line above or vice/versa wherever you register the rewrite rules.

You'll see the rules appearing properly within the analyzer.

Hope this helps!

share|improve this answer
The page rewrite is built into WordPress, though. How would I make it work in that case? – Manny Fleurmond Aug 17 '12 at 10:37
Did you add a content_type and content_series tags? Is this a rewrite rule? Can you post what you've done so I can get a better grasp on your situation. – Brian Fegter Aug 17 '12 at 14:24
I added the code I am using in the main question. Thank you for any suggestions you have. – Manny Fleurmond Aug 17 '12 at 23:47

Okay, after much experimenting, I found a solution. All I had to do was create some more custom rewrite rules to make it work:

//Custom rewrites
        $slug . '/page/([0-9]+)?/?$',
        $slug . '/([^/]+)/page/([0-9]+)?/?$',
        $slug . '/([^/]+)/([^/]+)/page/([0-9]+)?/?$',

These do the trick in the rewrite analyzer. Hopes this helps someone else.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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