Custom permalink for specific category

I got an answer on the WordPress forums. Here is the working code for those looking to do something similar: add_filter( ‘post_type_link’, ‘change_webinar_links’, 10, 2 ); function change_webinar_links( $link, $post) { if ( $post->post_type == ‘tribe_events’ && tribe_event_in_category(‘webinar’) ) { $link = trailingslashit( home_url(‘/webinars/’ . $post->post_name ) ); } return $link; } add_action( ‘init’, ‘webinar_rewrite_rule’, … Read more

How do I apply friendly URL permalinks to a custom WordPress template?

Add the following code In your main hooks file (maybe in functions.php) add_action(‘init’, ‘my_custom_rewrite_rules’); Then add this function function my_custom_rewrite_rules() { // The rule // Input: archives/publications/countries/kenya // Output: archive-template.php?posttype=publications&taxo=countries&slug=kenya add_rewrite_rule(‘archives/publications/countries/([^/]+)/’, ‘archive-template.php?posttype=publications&taxo=countries&slug=$matches[1]’, ‘top’); // Flush the rules (to activate them) flush_rewrite_rules(); } To learn more about regex and rewrite rules, those links might help https://regexone.com/ … Read more

Custom Permalinks with CPT and Hierarchical Taxonomies

CPT does’t have much options for building custom permalinks. What you need can’t be done without custom coding and creating new rewrite rules, and handling permalink parsing. I have plugin for working with post types and taxonomies, and it includes options for custom permalinks and more. It is not a free plugin, but in many … Read more

remove product-category base but still redirect to page with same permalink

Have a look at this https://kellenmace.com/remove-custom-post-type-slug-from-permalinks/ I use it with this plugin: Code Snippets By Shea Bunge This allows you to modify your functions.php file without having to directly edit it. This means WordPress core and theme updates won’t remove your changes. Finally, may I suggest you try using a staging plugin to make a … Read more

redirect/ %category%/%postname%.html to /%category%/%postname%

It sounds like you didn’t flush your permalinks. Remove what you wrote in your .htaccess. Set what you had that was working before in the custom section of the permalink settings %category%/%postname%.html, save it, select ‘plain’, save it, then change it to your new settings %category%/%postname% save it, select ‘plain’, save it, then go to … Read more