Most efficient use of custom taxonomies, categories, and pages
If you are looking to link the subcategory in your permalink only, here you go. Just check the child category only. Sub-category and category in permalink structure
If you are looking to link the subcategory in your permalink only, here you go. Just check the child category only. Sub-category and category in permalink structure
You can use get_ancestors for this: get_ancestors( $term_id, ‘taxonomy’ ); Of course this will only work on hierarchical elements. Additionally, this will only work reasonably well if only one term per level is assigned, take a look at my comment here and my answer here to get a little bit deeper insight into that.
I solved by force refreshing the cache (by @passatgt). i.e., place this line after the insertion: delete_option(“{$taxonomy}_children”); Thanks!
Custom Post Type Child Pages
taxonomy term names in custom post type permalink structure
How can I add a “fake” parent into the permalink?
Need help understanding a rewrite with multi-level taxonomy
I don’t know why that code didn’t work for you. I copy that code and it work exactly as I expected. You should double check your case, did you unset $args variable before, or you can use another name ($agrs2 for example). Another problem in you question is: if pad_counts doesn’t work, you will get … Read more
It might be because you are using reserved term name as first argument; ‘categories’ is wordpress core taxonomy and you should use something else like ‘ph_categories’. After that you will have to add those terms again. Reference: Codex
The start is easy. Let’s fetch all the posts from 2015: $posts = new WP_Query( ‘year=2015’ ); Now, we have an array of post objects, which we must sort into categories, duplicating them if they have multipe categories. The result goes into a multidimensional array. $categorized_posts = array (); foreach ($posts as $post) { $post_cats … Read more