how putting a “null position” in a taxonomy dropdown selector
how putting a “null position” in a taxonomy dropdown selector
how putting a “null position” in a taxonomy dropdown selector
How to use custom post type and taxonomy for car specs in wp
These seems like it won’t perform well (you’ll probably want to add it some caching), but it works: // Get all the terms for taxonomy. $terms = get_terms( array( ‘taxonomy’ => ‘wpse416749’, ) ); echo ‘<ul>’; foreach ( $terms as $term ) { // Get pages with the current term. $knowledges = new WP_Query( array( … Read more
Apparently, for the post term block variation automatic generation to work you need to register the custom taxonomies earlier in the process (a priority lower than 10). Example: add_action( ‘init’, ‘register_post_types’, 9 ); I don’t know if this is by design because it’s not documented anywhere in the Gutenberg docs.
I think you can achieve this by using JavaScript. You’ll need to add an event listener that triggers a redirect to the selected URL when the dropdown’s value is changed. Here’s one possible way of doing it. It’s the quickest way I can think of, and I haven’t tested it yet, but you get the … Read more
Yes. It is some kind of mapping. So now, when I register the custom taxonomy I pass it: $caps = array( ‘manage_terms’ => ‘activate_plugins’, ‘edit_terms’ => ‘activate_plugins’, ‘delete_terms’ => ‘activate_plugins’, ‘assign_terms’ => ‘edit_posts’ ); With this result authors can now assign terms. I am just using ‘activate_plugins’ because, by default, authors do not have this … Read more
because is_archive is earlier so it doesn’t evaluate the others, it’s checked from the top down and since is_archive is super generic it will be true for all archives, categories, tags, dates, etc etc. You need to go from the most specific to the least specific, not the other way around. Think of it like … Read more
I found a solution for this: <?php $current_term_id = get_queried_object_id(); $taxonomyName = “car-brand”; $parent_tax_ID = $current_term_id; $parent_tax = get_term($parent_tax_ID); $terms = get_terms( $taxonomyName, array( ‘parent’ => $parent_tax_ID, ‘orderby’ => ‘slug’, ‘hide_empty’ => false ) ); foreach ( $terms as $term ) { $image2 = get_field(‘am-brand-img’, $term); echo ‘ <div class=”am-ts-item”> <a href=”‘ . get_term_link( $term … Read more
Creating a page that will dynamically get posts from 2 taxonomies
According to this change, in version 6.3 WordPress was updated to support emptying the terms assigned to a post by passing an empty value in a way that won’t cause an error in PHP 8.1+. PHP treats ‘0’ as empty, so your code is treated as setting no terms on the post. If you want … Read more