Why can’t change the permalink of my page/post?

When you are in the page you want to update, you can modify the slug at the top above the editor: By default WordPress uses the Page title, but you can change the ‘slug’ to whatever you want. You can also look at Settings > Permalinks for some more options.

Strange behavior: random HTTP error 500 fixed by visiting Permalinks settings page (htaccess issue with language code)

Looks like it might be your WPML. See here: https://wpml.org/forums/topic/wpml-add-rewritebase-en-in-htaccess/ For posterity, the summary of this page is as follows: Problem: Some wrong settings caused an issue with “Use directory for default language”. A 500 error was showing. Solution: The client reports here that pressing the ‘Reset Settings’ button in WPML -> Languages probably solved … Read more

Divi change project category slug

add_filter( ‘register_taxonomy_args’, ‘change_taxonomies_slug’, 10, 2 ); function change_taxonomies_slug( $args, $taxonomy ) { if ( ‘project_category’ === $taxonomy ) { $args[‘rewrite’][‘slug’] = ‘stainless-steel-products’; } return $args; }

flush_rewrite_rules() not working with update_option_{$option}

flush_rewrite_rules() should be called very early within the WordPress initialization. The reason is that the entpoints cannot be changed afterwards. A solution could look like this: function updateMySlugOption($old_value, $value, $option) { if( $old_value != $value ) { set_transient(‘update_slugs’, 1); } } add_action( ‘update_option_mySlug’, ‘updateMySlugOption’, 10, 3); function update_slugs() { if( get_transient(‘update_slugs’) ) { flush_rewrite_rules(); delete_transient(‘update_slugs’); … Read more

Permalink problems with custom post type and custom taxonomy

There was a problem with archive page and pagination in the original answer. Therefore, instead of changing the “rewrite” => [‘slug’ => ‘our-training/%training-category%’] in register_post_type() as I suggested earlier, add the following rewrite rules and change the links created for CPT. The rules will handle such addresses: display single training post with pagination support /our-training/training-category-1/training-name/ … Read more

Combine multiple CPT names to create valid permalinks

Sally CJ commented an important detail that helped me reach what I needed. Apart from that I struggled with what seemed to be regex error – one of my rules was overriding another because there was no $ character in regex to end the string. Working solution for custom rewrites: function dd_custom_rewrite_rules() { add_rewrite_tag(‘%company%’, ‘([a-z0-9-]+)’, … Read more

Adding a prefix to the blog, but only the blog

In creating your post types register_post_type) you need to add with_front as false: ‘with_front’ (bool) Whether the permastruct should be prepended with WP_Rewrite::$front. Default true. so your rewrite could be ‘rewrite’ => array ( ‘with_front’ => false), or if it’s already there with a new slug something like this: ‘rewrite’ => array(‘slug’ => ‘post_slug’, ‘with_front’ … Read more