Custom field drop down to set the term of the post when published
Access your post data as a real array: $_POST[‘magicfields’][‘shop_artist’][1][1]. Do a var_dump($_POST) if in doubt.
Access your post data as a real array: $_POST[‘magicfields’][‘shop_artist’][1][1]. Do a var_dump($_POST) if in doubt.
do you know where is your code fails? Is the hook runs properly? One thing for sure, term_exists() returns the ID not an object. Also $wpdb is not needed at all. wp_delete_term($theterm, ‘byartist’);
<?php $terms = get_the_terms(); echo ‘<ul class=”styles”>’; foreach($terms as $term){ echo “<li>”.$term->name.”</li>”; } echo “</ul>”; ?>
You’ll have to adjust the markup to suit your specific needs, but the easiest solution would use a post_class filter on the post_class() template tag, to output appropriate classes. For example, in your template, you need to call post_class(), such as: <div <?php post_class(); ?>> <div class=”car_type”>Ford</div> (background green) Post Title<br> Post Content<br> </div> Then, … Read more
Get term_taxonomy_id from return of wp_insert_post
Get only last child category link of products
Not sure what the problem is, you’re practically there! You can use your code anywhere (as long as it’s after the init hook), not just in template files. $terms = get_terms( ‘MYTAXONOMY’ ); $term_slugs = wp_list_pluck( $terms, ‘slug’ ); wp_list_pluck() is a very cool little function that will pluck a field out of an array … Read more
The parent argument should do what you are asking. parent (integer) Get direct children of this term (only terms whose explicit parent is this value). If 0 is passed, only top-level terms are returned. Default is an empty string. http://codex.wordpress.org/Function_Reference/get_terms That is parent=14 should get all of the immediate children of term 14, but no … Read more
Alright, I have found a way. If it can be useful for someone here is how I solved it: $terms = get_the_terms( $post->ID , ‘custom_taxonomy’ ); if($terms) { foreach( $terms as $term ) { $term_id = $term->term_id; } } Then you can use $term_id in your expression.
When I Use function wp_insert_term() function it gives me Invalid taxonomy object