How to start a new post with custom Taxonomies already set?

You can use the transition_post_status action for that. New posts transition from new to auto-draft, so we check for that condition to only add terms on that initial auto-save. function wpd_add_post_terms( $new_status, $old_status, $post ) { if( ‘new’ == $old_status && ‘auto-draft’ == $new_status ){ wp_set_post_terms( $post->ID, array( 42, 23 ), ‘category’ ); } } … Read more

WordPress loop: Show only a Custom Post Type Taxononmy TERM

I found the solution by myself, I leave it here in case someone is interested: <?php $args = array( ‘post_type’ => ‘agrupados’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘pedidos’, ‘field’ => ‘slug’, ‘terms’ => ‘ferrol’, ), ),); $the_query_slide = new WP_Query( $args ); if ( $the_query_slide->have_posts() ) {while ( $the_query_slide->have_posts() ) {$the_query_slide->the_post();?> <?php /* variables … Read more

Why does a new taxonomy term get created when I assign an existing term to a post?

Thanks to @Milo for the solution. I deleted all the defaults to condense the code, and then changed the ‘meta_box_cb’ parameter to ‘post_categories_meta_box’, and it did indeed give me a tag-style metabox. As an aside, that’s not exactly what I envisioned, so I ended up using CMB2‘s taxonomy_radio field to get what I was after … Read more