wp_dropdown_categories – how to save in widget?

You didn’t add the dropdown/select name attribute, that’s why it’s not working as expected. Please try updating your $dropdown_args, here’s the updated arguments – $dropdown_args = array( ‘taxonomy’ => ‘cs_categories’, ‘id’ => $this->get_field_id( ‘cs-category’ ), ‘name’ => $this->get_field_name( ‘cs-category’ ), // Added this line ‘show_option_none’ => __( ‘Select category’, ‘text-domain’ ), ‘hide_empty’ => true, ‘hierarchical’ … Read more

SOLVED Custom Add rewrite rule and Get string

The values parsed out of internal rewrites don’t end up in GET, you have to use get_query_var(‘search_location’) instead. If you have code that you can’t edit that relies on GET, you can try to set them manually- function wpd_foo_get_param() { if( false !== get_query_var( ‘search_location’ ) ){ $_GET[‘search_location’] = get_query_var( ‘search_location’ ); } } add_action( … Read more

Can’t get taxonomy ID for each post on archive page

From the help of the comments above I needed to use get_term_terms to print the ID. I used the code below to achieve what I needed: <?php $terms = get_the_terms( $post->ID, ‘producers_assessment’ ); foreach($terms as $term) {?> <?php $image = get_field(‘badge’, ‘producers_assessment_’ . $term->term_id); if( !empty($image) ): ?> <img src=”https://wordpress.stackexchange.com/questions/295839/<?php echo $image[“url’]; ?>” alt=”https://wordpress.stackexchange.com/questions/295839/<?php echo … Read more

Only allow posts with a specific term to only be viewed by other authors with the same term in their post

You’d do something like $current_user = wp_get_current_user(); to get the current user, then you’d want their posts $current_user_posts = get_posts(array( ‘author’ => $current_user->ID, ‘posts_per_page’ => -1 ); with their posts, you’d cycle through them, and grab the terms $current_user_terms = array(); foreach ($current_user_posts as $user_post) { $user_terms = wp_get_post_terms($user_post->ID, ‘custom_tax’, array(“fields” => “ids”)); foreach ($user_terms … Read more