Remove taxonomy widget from “PAGE” post

In your register_taxonomy() args, set meta_box_cb => false ‘meta_box_cb’ (bool|callable) Provide a callback function for the meta box display. If not set, post_categories_meta_box() is used for hierarchical taxonomies, and post_tags_meta_box() is used for non-hierarchical. If false, no meta box is shown. $args = array( //other args ‘meta_box_cb’ => false, ); register_taxonomy( $args );

Dynamically set taxonomy term and show admin notice on post save

Okay, so just in case anyone needs help on the same thing I did… here is my solution. Instead of a php/wordpress solution, I used javascript. Id love to see the php/wordpress solution if someone wants to post it. <?php // Admin Custom JS add_action(‘admin_head’, ‘admin_custom_js’); function admin_custom_js() { ?> <script> // update date (month) … Read more

Show only the sub-categories (and their content) of the current custom taxonomy with ‘taxonomy.php’

I think you can easily achieve that if you understand WordPress template hierarchy. Looking at the template hierarchy diagram, and assuming you have categories and sub-categories, then you can achieve what you want in multiple ways. Suggestion 1 Use category.php to display the posts of any category, including sub-categories. also in category.php add a condition … Read more

wp_insert_term() doesnt insert a term

Thanks to Milo who asked an important question: Where is this code? I put it below where ive have registered the taxonomy and then it worked: function register_taxonomy() { $labels = array(…); $args = array(…); register_taxonomy( ‘ncategory’, null, $args ); $parent_term = term_exists( ‘Gender’, ‘ncategory’ ); // array is returned if taxonomy is given $parent_term_id … Read more

Filter through custom taxonomy with an array of taxonomy IDs

First, you can’t enter such expression as second argument in get_term(). Enter directly the name of your taxonomy… Are you dealing with simple post categories? If that’s the case, your taxonomy name is ‘category’. $context[‘single_term’] = get_term( $user_terms_array[1], ‘category’ ); Second, ensure that $user_terms_array contains term IDs as integer. $user_terms_array = array_map( ‘intval’, explode( ‘-‘, … Read more

Custom Taxonomy template not display

There are a couple of different solutions if you want to have only the /holliday/project-location/ URL and not separate archive and taxonomy URLs. Option 1: Use the template_include() filter. I think this code would work but have not tested: add_filter( ‘template_include’, ‘holliday_template’, 99 ); function holliday_template( $template ) { if ( is_post_type_archive( ‘holliday’ ) ) … Read more

Migrating Hierarchal Taxonomy Categories Between Post Types

So that at least there’s a solution here, will add that this plugin seems to succesfully migrate Posts as well as category and hierarchy.: https://wordpress.org/plugins/post-type-convertr. On the production server, I also needed to run the following SQL query after migrating with the Post Type Convertr plugin: UPDATE wp_term_taxonomy SET taxonomy=’project-category’ WHERE taxonomy=’product_cat’; I dunno. Sorry … Read more