Support » Fixing WordPress » Permalinks that filter both categories and taxonomies

  • Is it possible to show posts filtered by both taxonomies and categories?
    I have two categories: “News” and “Reviews”
    I have a custom taxonomy called ‘actor’.

    Can I show all the posts filled in the “News” category and “Tom Hanks” actor? Or all the news related to “Russel Crowe”? Or all the reviews related to “Tom Cruise”?

    Actually I have this permalink structure:

    I’d like to have

    I know that with the default wordpress permalink structure this isn’t possible. So I’ve tried to make a plugin but I haven’t got the result.

    This is the plugin:

    // Remember to flush_rules() when adding rules
    function flushRules(){
    	global $wp_rewrite;
    // Adding a new rule
    function wp_insertMyRewriteRules($rules)
    RewriteRule ^games/([^/]+)/([^/]+)$ games/?azione=mostra-gioco&g_system=$1&g_short_title=$2 [QSA,L]
    generate_rewrite_rules($permalink_structure, $ep_mask = EP_NONE, $page = true, $feed = true, $forcomments  = false, $walk_dirs = true)
    	global $wp_rewrite;
    	// add rewrite tokens
    	$actor_category = '%actor_category%';
    	$wp_rewrite->add_rewrite_tag($actor_category, '(.+?)', 'actor_category=');
    	$wp_rewrite->extra_permastructs = array ( '0' => '/actor/%actor%/%actor_category%', '1' => '0') +  $wp_rewrite->extra_permastructs;
    	$keywords_structure = $wp_rewrite->root . "/%actor%/%actor_category%/";
    	$keywords_rewrite = $wp_rewrite->generate_rewrite_rules($keywords_structure, $ep_mask = EP_NONE, $page = false, $feed = false, $forcomments = false, $walks_dir = false);
    	$wp_rewrite->extra_rules_top = $keywords_rewrite + $wp_rewrite->extra_rules_top ;
    	return $wp_rewrite->extra_rules_top;
    // Adding the id var so that WP recognizes it
    function wp_insertMyRewriteQueryVars($vars)
    	$vars[] = "actor_category";
        return $vars;

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Permalinks that filter both categories and taxonomies’ is closed to new replies.