How to redirect Webp files?

If I’m reading it right, your regex has only two items in (), which means that only $1 and $2 have any meaning. I copied your sample text and went to https://regex101.com/ (note: this is not an endorsement) to try to assemble a regex that’ll cover all your images. Here’s what I ended up with: … 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; }

Bilingual WP site: How to achieve different URL sturcture rule based on its language?

Try the following steps: Add the rewrite rules for the <language>/blog/%category%/%post_id% structure. I used the post_rewrite_rules hook to add the rewrite rules, but for generating the rewrite rules, I used WP_Rewrite::generate_rewrite_rules() the same way WordPress core used it to generate the rewrite rules for the default permalink structure (that you set via the Permalink Settings … 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

Postname on unique permalink structure appends “-2” for a custom post type. How can I get this to stop happening?

By default, WordPress disallow 2 identical slugs because if you change your permalink structure for custom structure, you should be able to have in your case: https://example.com/saint-louis/ https://example.com/saint-louis/ And you can understand, it’s impossible. The only way is checking by code, you are not in “custom structure” and then save in db with the WordPress … Read more