Add filter to Admin list for all custom post types by their custom taxonomies

I found a code which work only with single taxonomy and modified it. add_action( ‘restrict_manage_posts’, ‘my_restrict_manage_posts’ ); function my_restrict_manage_posts() { global $typenow, $post, $post_id; if( $typenow != “page” && $typenow != “post” ){ //get post type $post_type=get_query_var(‘post_type’); //get taxonomy associated with current post type $taxonomies = get_object_taxonomies($post_type); //in next loop add filter for tax if … Read more

Get fuzzy matches from get_term_by

There’re several questions you should ask yourself: #1) Are the “language codes” actually ISO 639-2 compatible? Stephen Harris and me build a list of all available ISO 639-2 language codes – [available on GitHub on the WeCodeMore-Label account] – that should be used. This is the official list (build from the official ISO source). In … Read more

Custom Taxonomy dont save in a frontend form for post a custom post

I think you have used wrong tax_input parameter value for wp_insert_post() function it should be array like this array( ‘taxonomy_name’ => array( ‘term’, ‘term2’, ‘term3’ ) ) as shown in the following code $my_post = array( ‘post_title’ => $title, ‘post_content’ => $content, ‘post_status’ => ‘publish’, ‘post_type’ => ‘faenas’, ‘tax_input’ => array( ‘faenas_combenef_category’ => array( $location … Read more

WordPress custom taxonomy

get_terms(); accept include as an array, you are trying with a string term id instead of array, try this $parent_terms = get_terms($taxonomyName, array(‘include’ => array(’67’), ‘orderby’ => ‘slug’, ‘hide_empty’ => false));

Show terms in archive page

get_terms() retrieves terms in general, it makes no connection to a current post in loop. What you need is one of template tags, which retrieve terms for the post. For example the_terms(): while (have_posts()) : the_post(); the_terms( get_the_ID(), ‘event_cat’ ); endwhile; There are quite a few functions dealing with terms, depending on what you want … Read more

Add custom post type taxonomy tag to article class

Ah, solved it! <aside class=”work_item <?php $posttags = get_the_terms($post->ID, ‘type’); if ($posttags) { foreach($posttags as $tag) { echo str_replace(‘-‘,’_’,$tag->slug . ‘ ‘); } } ?>” data-type=”<?php $posttags = get_the_tags(); if ($posttags) { foreach ($posttags as $tag) { echo str_replace(‘-‘,’_’,$tag->slug . ‘ ‘); } } ?>”> had to use the get_the_terms() function

Adding Child Terms Programatically – No Warning but No dice either

It doesn’t work because you use wp_insert_term function incorrectly. Please read the codex manual page carefully and you will see that the second argument is not parent slug, but your custom taxonomy. So your function should look like this: create_taxonomy_record($args) { $parent_term = 0; if (!empty($args[2]) && ($parent_term = term_exists($args[2], $args[1])) { $parent_term = $parent_term[‘term_id’]; … Read more