How to Include the Parent and Child Category in the Permalink if the Post is Added to Both

There are a few answers, scattered around this forum. To summarise: Configure your Permalinks: Head to Dashboard > Settings > Permalinks Scroll down to ‘Product Permalinks’ and select ‘Custom Base’. Enter /%category%/ into the text field and then select ‘Save’. Assign Product Categories: If your products are still not showing the Child Categories, within the … Read more

Is there a log for the ajax calls made when changing a post’s slug?

If we trace the Ajax process after you click OK, we would walk the following path from the core and into the database: Press OK on Edit slug: \ \-> AJAX POST request with action=sample-permalink Action: wp_ajax_sample-permalink \ \-> function: wp_ajax_sample_permalink() \ \-> function: get_sample_permalink_html() Filter: get_sample_permalink_html \ \-> function: get_sample_permalink() Filters: get_sample_permalink, editable_slug \ … Read more

How can I Rewrite a ‘page’ URL based on query string parameters?

You can add a rewrite rule such as the following. Make sure to register your public query vars with WordPress so it recognizes your rewrite rule vars. add_rewrite_rule(‘^(tips)/([^/]*)/([^/]*)/?’, ‘index.php?name=$matches[1]&id=$matches[2]&filter_id=$matches[3]’,’top’); add_filter(‘query_vars’, ‘foo_my_query_vars’); function foo_my_query_vars($vars){ $vars[] = ‘id’; $vars[] = ‘filter_id’; return $vars; } Visit the Permalinks Settings page to flush your permalinks. You can access your … Read more

%tag% in permalink not working

@Atari asked for a solution.. People who do not have one should not butt in! I have the same issue. All other %category% %postname% %post_id% etc. resolve fine, but %tag% remains %tag% in the final permalink! I think it is a bug. I came across a patch which was for an older version. I did … Read more

Include Taxonomy slug in post url

Add Custom Taxonomy Tags to Your WordPress Permalinks What you wish to do is have your taxonomy available to use within the Permalink structure e.g. /%actor%/%postname% First you write your taxonomomy as you have already done, but you require additional fields: add_action(‘init’, ‘add_actor_taxonomy’); function add_actor_taxonomy() { if (!is_taxonomy(‘actor’)) { register_taxonomy( ‘actor’, ‘post’, array( ‘hierarchical’ => … Read more

How to fix a double slash in custom permalinks with hierarchical taxonomy’s?

There is a quick and somewhat dirty potential solution to this. I say ‘potential’ because I can’t spot the problem by looking at the code. I only have my suspicions. Instead of passing a separator like that. Try trailingslashit. } else $chain .= trailingslashit($name); return $chain; I am guessing at where the problem is based … Read more

Changing pemalink structure to /%post_id%/%postname%/

I think I got it. Made a test site. With permalink structure: year/moth/day/postname. Published a post. Then changed permalinks to postID/post-name. Tested with looking at network stats from the browser. Here’s what I got, a 301 redirect, after trying example.com/2018/11/04/hello-world/ from my browser: I tested another thing. Using different permalink structures, I tried to make … Read more