custom post type and custom taxonomy permalink

Something similar to this in your functions.php or a plugin will do the trick: function custom_rewrite( $wp_rewrite ) { $feed_rules = array( ‘([^/]+)/cases/([^/]+).html’ => ‘index.php?genre=”. $wp_rewrite->preg_index(1) .”&case=”. $wp_rewrite->preg_index(2) ); $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’, ‘custom_rewrite’ ); You will need … Read more

WordPress 4.4+ breaks Walker Extension

Your original solution was a hack, and no surprise it failed. In general never add methods/attributes to objects that you do not control their class and future development. The right way is to create your own object to be passed to the walker. Pass to it the category object on construction and either populate fields … Read more

Change permalinks for post type ‘post’ only

I found the answer here. Remember to pop in there and give it a like. I’ll post it here, for people in a rush. Put this into the functions.php-file: function wp1482371_custom_post_type_args( $args, $post_type ) { if ( $post_type == “post” ) { $args[‘rewrite’] = array( ‘slug’ => ‘blog’ ); } return $args; } add_filter( ‘register_post_type_args’, … Read more

Custom permalink structure only for default posts

The solution is to reregister the default post type just after WordPress, and to add a rewrite slug. Also, the _builtin param needs to be set to false. add_action( ‘init’, ‘my_new_default_post_type’, 1 ); function my_new_default_post_type() { register_post_type( ‘post’, array( ‘labels’ => array( ‘name_admin_bar’ => _x( ‘Post’, ‘add new on admin bar’ ), ), ‘public’ => … Read more

Numeric slug on child post

As you guessed and @Rarst suspected, there’s a pagination check in wp_unique_post_slug() for hierarchical post types: preg_match( “@^($wp_rewrite->pagination_base)?\d+$@”, $slug ) which will match any numeric only slug, optionally preceded by “page”. To get around this you could use the ‘wp_unique_post_slug’ filter, basically replicating the original code without the pagination check, eg add_filter( ‘wp_unique_post_slug’, function ( … Read more