WordPress different custom tag being displayed in on tag list
WordPress different custom tag being displayed in on tag list
WordPress different custom tag being displayed in on tag list
If you want to output a list of terms that are assigned to the posts in the current query, you could use something like this in your template: global $wp_query; $terms = []; foreach ( $wp_query->get_posts() as $item ) { $item_terms = wp_get_post_terms( $item->ID, ‘web_cat’ ); $terms[] = $item_terms; } $unique = array_unique( array_merge(…$terms), SORT_REGULAR … Read more
I wonder if you got any term_links-genre filters that could be modifying your get_the_term_list() output? Your code example should in general work as expected, but you might want to use the get_the_terms() function to better control the output to your own likings. Here’s a modifed version of the corresponding Codex example: /** * Customized the … Read more
I’ve used code like this, based (extremely) loosely on the plugin relevanssi: (in “functions.php”) // Roughly based on the relevanssi_do_excerpt() (https://wordpress.org/plugins/relevanssi/, GPLv2 or later), seriously simplified. function mytheme_search_context( $haystack, $needles, $len = 30 ) { $ret=””; $haystack = strip_tags(mytheme_strip_invisibles($haystack)); $haystack = trim( preg_replace( array( “/\n\r|\r\n|\n|\r/”, ‘/\s\s+/’, ‘/&.{1,30}?;/’ ), ‘ ‘, $haystack ) ); $words = … Read more
Thanks to Laxmana‘s comment above I found the solution. The plugin User Access Manager has a setting in its options to hide empty categories. It is enabled by default. I disabled the option and now all categories are shown. Thank you for your help, especially thanks to Laxmana!
Prior to 4.5.0, the first parameter of get_terms() was a taxonomy or list of taxonomies: Since 4.5.0, taxonomies should be passed via the taxonomy argument in the $args array: So, the lines /** * Get the family */ $args = array( ‘parent’ => $topmost->term_id, ); $family = get_terms($taxonomy_name, $args); should be /** * Get the … Read more
Wow, it just works… I can use wp_set_object_terms() to set a term to a term… $term_taxonomy_ids = wp_set_object_terms( $bill_term_id, $microsoft_term_id, ‘company’ ); And I can retrieve the company connected to a person with wp_get_object_terms like… $bills_company_terms = wp_get_object_terms($bill_term_id, ‘company’); The only thing is, how can I put a backend interface on these relationships?
Taxonomy Child Not Updating Unless I Click Update Twice
Create taxonomy terms from custom field values
List the category tree of all the product_cat categories