Dynamically Create Terms in Taxonomy when Custom Post Type is Published. Almost There!

You’re almost there – the problem is you’re trying to access the $post object when the function only receives the post ID. add_action( ‘publish_country’, ‘add_country_term’ ); function add_country_term( $post_ID ) { $post = get_post( $post_ID ); // get post object wp_insert_term( $post->post_title, ‘country_taxo’ ); }

The same slug in multiple taxonomies

When you say keyword, do you mean term? I just did a quick test to confirm: I can have the same term, which has the same slug, in both the Category and Post Tag taxonomies, so I assume that custom taxonomies likewise can have terms with the same slug. So, might there be some taxonomy/term … Read more

WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?

I had the same question a couple of weeks ago. Here’s what I did to make it work for me. How Do I Use WP_Query to Run This Database Query as Search Result? If you’ll read through my answer that I posted for reference’s sake, you’ll see that I ended up adding a filter add_filter(‘post_request’,’your_function_name’); … Read more

Glossary with Custom Post Type

$index = 0; $terms = get_terms(‘marke’); $range = array_merge(range(0, 9), range(‘A’, ‘Z’)); echo ‘<ul>’; foreach ($terms as $term) { if(ord($range[$index]) <= ord(strtoupper(substr($term->name, 0, 1)))) { while($range[$index] != strtoupper(substr($term->name, 0, 1))) { echo ‘<li>’. $range[$index] . ‘</li>’; $index++; } $index = strtoupper(substr($term->name, 0, 1)); echo “<li><a href=””.get_term_link($term).”” />{$range[$index]}</a></li>”; $index++; } }

Retrieving custom taxonomy in order, but excluding specific tax IDs

Alas no answers or comments! 😛 Not to worry, a colleague helped me out here and here is the above code working with an $exclude function terms_by_order($taxonomy, $exclude) { global $post; $terms = get_the_terms($post->ID, $taxonomy); // check input if ( empty($terms) || is_wp_error($terms) || !is_array($terms) ) return; // exclude foreach ($terms as $key=>$term) { if … Read more