Taxonomy based permalinks

Try something like this: function custom_rewrite( $wp_rewrite ) { $feed_rules = array( ‘(.+)/blog/(.+)’ => ‘index.php?custom_tax=’.$wp_rewrite->preg_index(1).’&post_name=” . $wp_rewrite->preg_index(2) ); // ( array merge must be done this way, to ensure new rule comes first ) $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules; } // refresh/flush permalinks in the dashboard if this is changed in any way add_filter( “generate_rewrite_rules’, … Read more

Custom post type permalinks giving 404s

My plugin Custom Post Permalinks does this sort of thing for you: http://wordpress.org/extend/plugins/custom-post-permalinks If you’d rather use your own solution, I’ll need a bit more information, such as the registration code for the forums taxonomy. Just guessing, I’m thinking the regex for a forum looks identical to the regex for a topic to the rewrite … Read more

Custom url structure for custom template

In the link you attached, you have everything you need. You should: add query variable (e.g operators_actv), add rewrite rule that sets this variable (operators_actv), use the template_include action hook to load custom template if query variable operators_actv is set. Code: add_filter( ‘query_vars’, ‘se332319_custom_query_vars’ ); add_filter( ‘template_include’, ‘se332319_custom_template’, 50 ); add_action( ‘generate_rewrite_rules’, ‘se332319_resources_cpt_generating_rule’ ); function … Read more

Rewrite rule never matching

Please try this. First add the rewrite rule you need with this function add_action( ‘init’, ‘rewrite_site_tools_page’ ); function rewrite_site_tools_page() { add_rewrite_rule( ‘^site-tools-([^/]+)$’, ‘index.php?pagename=site-tools&tool=$matches[1]’, ‘top’); } Assuming that page name is site-tools. Now add the tool as query var add_filter(‘query_vars’, ‘wpd_query_vars’); function wpd_query_vars( $query_vars ){ $query_vars[] = ‘tool’; return $query_vars; } Save permalinks. Now if you … Read more

Writing Custom Rewrite Rules that Incorporate Category for Custom Post Types?

You could use my plugin: http://wordpress.org/extend/plugins/custom-post-permalinks/ That will only work if it’s a non-hierarchical post type. If it’s hierarchical, you’re going to have to register the permastruct yourself. This is a huge ordeal which I don’t have the time to write out at the moment. You can look at the code in my plugin above … Read more