Custom rewrite after the default term link URL

(Revised answer) So Let’s See The Issues With Your Rewrite Rule.. The first parameter passed to add_rewrite_rule() (which is the regular expression pattern) should not start with home_url() or any functions which outputs the website URL. So this is wrong: home_url() . ‘/car/([^/]*)/([^/]*)/?’ because the generated regular expression (RegEx) pattern would be: http://example.com/car/([^/]*)/([^/]*)/? which will … Read more

How to add custom taxonomy in custom post type permalink?

Solution would be a little tricky but you’re on the right path. You need to register taxonomy and post type with dynamic rewrite: function wpse346452_cpt() { register_taxonomy( ‘campaign’, ‘asset’, array( ‘label’ => ‘Campaing’ ) ); register_post_type( ‘asset’, array( ‘public’ => true, ‘label’ => ‘Asset’, ‘rewrite’ => array( ‘slug’ => ‘%campaign_name%’, ), ) ); } add_action( … Read more

How to add custom rewrite rules and point to specific templates

You need to create query_var for sector and you need to create a rewrite rule with RegEX. I created a plugin for this. Create a file and add into the wp-content/plugins folder and activate it. <?php /* Plugin Name: Custom Rewrite Plugin URI: https://serkanalgur.com.tr Description: Custom Rewrite Version: 1 Author: Serkan Algur Author URI: https://www.serkanalgur.com.tr … Read more

add_rewrite_rule to remove /category/ from permalink

I believe the rewrite rule your wanting to alter is this category/(.+?)/?$ index.php?category_name=$matches[1] category to do what you want it should just be a case of adding the following rewrite rule in your functions.php add_rewrite_rule(‘(.+?)/?$’, ‘index.php?category_name=$matches[1]’, ‘top’); this should work but might conflict with other rules so that will be worth checking.

Redirect to another page using contact form 7? [closed]

Redirect to another page using contact form 7? [closed]

Add a permalink variable onto custom post type URL after post name slug

Here’s a complete working example that adds a post type, with extra rule to capture an additional parameter: function wpd_post_type_and_rule() { register_post_type( ‘mycpt’, array( ‘labels’ => array( ‘name’ => __( ‘mycpt’ ), ), ‘public’ => true, ‘rewrite’ => array( ‘slug’ => ‘mycpt’ ), ) ); add_rewrite_tag( ‘%mycpt_var%’, ‘([^/]*)’ ); add_rewrite_rule( ‘^mycpt/([^/]*)/([^/]*)/?$’, ‘index.php?mycpt=$matches[1]&mycpt_var=$matches[2]’, ‘top’ ); } … Read more

Custom rewrite rule ignored

The rewrite rules are correct, but because you are modifying the $wp_rewrite directly, you aren’t getting the benefit of being able to add the rule to the top of the stack using add_rewrite_rules. You are on the right track with the location of the rule in the array, but rules at the top are checked … Read more