Get term_taxonomy_id from return of wp_insert_post
Get term_taxonomy_id from return of wp_insert_post
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
Notice that the strip_tags() will remove all HTML tags. If you want to allow <br>, then you can add it as the second input parameter: echo strip_tags( $text, ‘<br>’ ); I want to display them like a list For that case, you could try this example: <p class=”nom”> <ul> <?php the_terms( get_the_ID(), ‘project_tag’, ‘<li>’, ‘</li><li>’, … Read more
While I can’t guarentee that this is what you are looking for (as you have not posted what your expected output should be), hopefully this will help. Even if it’s not exactly what you are looking for, you have the whole object for each term available to you so that you can manipulate the output … Read more
Then try to add foreach ( $arr_terms as $terms_links ) { if(!empty($terms_links)) { echo ‘<a href=”#”>’ . $terms_links . ‘</a>’; } } That checks if the $terms_links is empty, and if so it wont print it out.
I got it solved on my own so, wanted to answer my own question. in options table the results are cached, so I queried it and delete that. SELECT * FROM `wp_options` WHERE `option_name` like ‘%department%’ department is my taxonomy name here. You can check the function _get_term_hierarchy in taxonomy.php in wp-includes folder.