wp_set_post_terms struggle :(

Just by posting.. I made a final test. And I suspected a conflict somewhere in the custom taxonomy names, what I did is I changed the name of the custom taxonomy in function.php wp_set_post_terms( $post_id, $county, ‘kommun1’); is working well 🙂 I got so focused on the variable. my bad… have a nice day

How to show term child only if has a post

AS per my knowledge you need to write following function in your functions.php and check whether the term has post using the below function function check_term_posts($tax_slug, $term_id) { $args = array( ‘post_type’ => ‘post’, ‘status’ => ‘publish’, ‘tax_query’ => array( array( ‘taxonomy’ => spanishcategory, ‘field’ => ‘term_id’, ‘terms’ => 169 ) ) ); $term_query = … Read more

How to show terms used only for particular custom post type. Filter creation perpose

You need to send param post_id in ajax of data. Then in your plugin parse it and and search by taxomony. My simple example: <?php // in ajax handler // get post_id from requst data $post_id = filter_var($_POST[‘post_id’], FILTER_VALIDATE_INT); // find post $post = get_post($post_id); But before you need register the taxomony. register_taxonomy(‘auto’, array($post->post_type), array( … Read more