custom taxonomy and custom post type url conflict

Try this code. It may help you. class Tax_Seo_Perma { public function __construct() { // Hooks add_filter(‘rewrite_rules_array’,array($this, ‘create_rewrite_rules’)); add_filter(‘wp_loaded’, array($this, ‘flush_rules’)); add_filter(‘post_link’, array($this, ‘modify_link_addresses’), 10, 3); //add_filter(‘post_type_link’, ‘tsp_write_link_addresses’, 10, 3); } public function flush_rules(){ global $wp_rewrite; $wp_rewrite->flush_rules(); } public function create_rewrite_rules($rewrite) { global $wp_rewrite; // loop through custom taxonomies $args = array( ‘public’ => true, … Read more

Rewrite URL – insert custom variables as a directory path

I think you wanna do something like this: add_action(‘init’, ‘my_rewrite’); function my_rewrite() { global $wp_rewrite; // Your desired structure $permalink_structure=”/prodotti/%my_custom_variable%/%postname%/” // add the custom variable to wp_rewrite tags $wp_rewrite->add_rewrite_tag(“%my_custom_variable%”, ‘([^/]+)’, “my_custom_variable=”); // Here you need to know the name of the custom post type you want the permalink structure to be used on $wp_rewrite->add_permastruct(‘custom_post_type_name’, $permalink_structure, … Read more

Rewrite sub folder dynamically with country code in WordPress using PHP

I think the most difficult part is to remove the subfolder part from the url with WordPress website on both places. What if you change subfolder name to international and change rewrite rules to have ISO codes before the urls? So you would have: http://example.com http://example.com/international/uk http://example.com/international/us To add the iso codes you try to … Read more