I am triying to modify wordpress (version 3.3) for that the listing to be able to show posts from one taxomy and one category.

I have installed two plugin:

WP No Category Base WP No Taxonomy Base

These allow me to show post with this kind of url: domain[.]com/taxonomy-1 and domain[.]com/category-1

At this poing I am triying to get the results with domain[.]com/taxonomy-1/category-1

¿Which is the function about this?


3 Answers 3


You are going to have to get into URL re-writing which is notoriously pretty complex. However, there are several good answers on this site explaining how to do something similar. This one in particular

Many to Many Taxonomies or rewrite rules?

I also followed the tutorial Advanced Taxonomy Queries with Pretty Urls... which is very similar in scope.

  • Thank you, your links were very usefull. To achieve "taxonomy/category" form, is necessary to store a rule for each combination. At this point, i have choiced to have a base for each concept. Solution in the bottom. Commented Sep 26, 2012 at 8:38
function eg_add_rewrite_rules() {
    global $wp_rewrite;

    $new_rules = array(
        'location/(.+)/category/(.+)/?$' => 'index.php?location=' . $wp_rewrite->preg_index(1) . '&category_name=' . $wp_rewrite->preg_index(2)
    $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
add_action( 'generate_rewrite_rules', 'eg_add_rewrite_rules' );

Does not work :(


Problem solved changing base name of category and taxonomy (not removing)

In functions.php (or in plugin if you want).

You must put this code to rewrite this url www.example.org/en/[mylocation]/de/[mycategory]

  add_action('init', 'flush_rewrite_rules'); 
  add_filter('category_rewrite_rules' , 'add_rules' ) ;  

  function flush_rules() {

    global $wp_rewrite;


  function add_rules($rules) 
     * Loop em.
     * -------------------------------------------- */    

    $feed_rule  = 'index.php?location=$matches[1]&category_name=$matches[2]&feed=$matches[3]';
    $paged_rule = 'index.php?location=$matches[1]&category_name=$matches[2]&paged=$matches[3]';
    $base_rule  = 'index.php?location=$matches[1]&category_name=$matches[2]';

    $rules['en/([^/]+)/de/([^/]+)/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$'] = $feed_rule;
    $rules['en/([^/]+)/de/([^/]+)/page/?([0-9]{1,})/?$']                  = $paged_rule;
    $rules['en/([^/]+)/de/([^/]+)/?$']                                    = $base_rule;

    $feed_rule2  = 'index.php?location=$matches[1]&feed=$matches[2]';
    $paged_rule2 = 'index.php?location=$matches[1]&paged=$matches[2]';
    $base_rule2  = 'index.php?location=$matches[1]';

    $rules['en/([^/]+)/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$'] = $feed_rule2;
    $rules['en/([^/]+)/page/?([0-9]{1,})/?$']                  = $paged_rule2;
    $rules['en/([^/]+)/?$']                                  = $base_rule2;

    return $rules;

  • Glad you have this sorted. One item of note, you should not flush the re-write rules on the init hook. This means the rules will be flushed and re-written every time your site loads. This is very inefficient. The rules can be flushed simply by re-saving your permalinks. Commented Sep 26, 2012 at 21:22
  • Thank you for the anwser, so, please, ¿what is the action to save permalinks? Commented Nov 19, 2012 at 11:39
  • In the admin, go to Options->Permalinks and then save changes. Commented Nov 20, 2012 at 13:11

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.