New answers tagged

0

EUREKA! My taxonomy name is 'store-category'. When i used 'rewrite' = true or 'rewrite' = array('slug' => 'category') it was giving me a 404 error. When I changed it to 'rewrite' => array('slug' => 'group') the problem just went away! So, the problem turned out to be a rewrite conflict. WordPress had been looking for my store-categories within ...


0

I wanted to display the terms with the get_the_term_list function so, since categories & taxonomy have a "similar logic", I replaced the "the_category_list" add_filter( 'the_category_list', 'ci_theme_the_category_list_remove_parent_categories', 10 ); with "get_the_terms" add_filter( 'get_the_terms', '...


0

Also you can declare a variable. $taxonomy = get_the_terms( get_the_ID(), 'taxonomy' ); foreach ( $taxonomy as $tax ) { echo esc_html( $tax->name ); }


1

It's actually pretty simple: You'll want to use an OR relation, and use the NOT EXISTS operator for selecting posts that are not assigned to any terms in the specified taxonomy. $tax_query[] = array( 'relation' => 'OR', array( 'taxonomy' => 'location', 'field' => 'name', 'terms' => $location, ), array(...


0

The problem is here: while ( $query->have_posts() ) { $query->the_post(); function filter_categories($categories) { foreach ($categories as $category) { echo $category->name; } } You ...


0

I know the question is answered, but if anyone is trying to achieve the same with a raw SQL query, you could try the following: SELECT * FROM wpiw_posts WHERE ID IN ( SELECT object_id FROM wpiw_term_relationships AS TR INNER JOIN wpiw_term_taxonomy AS TT ON TR.term_taxonomy_id = TT.term_taxonomy_id INNER JOIN wpiw_terms AS T ON TT....


Top 50 recent answers are included