I have actor and genre taxonomies.
add_action('init','ap_url_redirect_rules');
add_filter('query_vars', 'ap_register_query_vars');
function ap_url_redirect_rules(){
add_rewrite_rule('([^/]+)?$', 'index.php?actor=$matches[1]', 'top'); // .com/brad-pitt
add_rewrite_rule('([^/]+)/([^/]+)?$', 'index.php?actor=$matches[1]&sort=$matches[2]', 'top'); // .com/brad-pitt/popular or new, etc.
add_rewrite_rule('genre/([^&]+)?$', 'index.php?genre=$matches[1]', 'top'); // .com/genre/comedy
add_rewrite_rule('genre/([^/]+)/([^/]+)?$', 'index.php?genre=$matches[1]&sort=$matches[2]', 'top'); // .com/genre/popular or new, etc.
flush_rewrite_rules();
}
function ap_register_query_vars($query_vars){
$query_vars[]='sort';
return $query_vars;
}
I have this code. Actor rewrite rule is working but genre and single post (post link) not working (404 Page Not Found). What is my wrong?