Check if current user has a post and that post has any term/s from a specific custom taxonomy outside the loop

This can be done using WP_Query using author and tax_query. Something like this: $args = array( ‘post_type’ => ‘post’, ‘author’ => get_current_user_id(), ‘tax_query’ => array( array( ‘taxonomy’ => ‘custom-taxonomy’, ‘operator’ => ‘EXISTS’ ), ), ); $query = new WP_Query( $args ); And then check if posts are returned through this query. Please note that this … Read more

Modify output of wp_dropdown_categories to add term IDs to each option

get_terms ended up bring a more customizable solution which is working for my needs. I was able to easily add the term IDs to each option as needed. Hope this helps someone else. <div class=”location-cats-dropdown”> <form id=”location-category-select” class=”location-category-select” method=”get”> <?php $loc_cats = get_terms( array( ‘taxonomy’ => ‘location_category’, ‘hide_empty’ => true, ‘orderby’ => ‘menu_order’, ‘order’ => … Read more

How to get dropdown instance value in WordPress custom Widget

The cat_drop setting is empty because your drop-down menu, or the select field doesn’t have the proper name value, so PHP isn’t receiving the selected option/value. So to fix the issue, just add the proper name value to the select field: <!– Wrapped for brevity. –> <select name=”<?php echo $this->get_field_name( ‘cat_drop’ ); ?>” id=”<?php echo … Read more

WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have

Edited: This is a much simpler version of what you are looking to do. You don’t need WP_Query(). You can use a foreach loop and an iterator: <?php echo ‘<ul class=”job-category-list”>’; // Get the terms and order them by count in descending order. $terms = get_terms( [ ‘taxonomy’ => ‘job_listing_category’, ‘orderby’ => ‘count’, ‘order’ => … Read more