Any way to make custom taxonomy field searchable?

Here’s the code. You can change $post_type and $custom_fields according to your needs. function extend_admin_search( $query ) { // Extend search for document post type $post_type=”document”; // Custom fields to search for $custom_fields = array( “_file_name”, ); if( ! is_admin() ) return; if ( $query->query[‘post_type’] != $post_type ) return; $search_term = $query->query_vars[‘s’]; // Set to … Read more

query_posts problem – need help

You’ll have to get the terms of current post with get_the_terms function and then use them in your query. // this will get terms and then get only term_ids from them $term_ids = wp_list_pluck( get_the_terms( get_the_ID(), ‘coupon_category’ ), ‘term_id’ ); $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $related = new WP_Query( array( ‘post_type’ => APP_POST_TYPE, … Read more

If I want to create new taxonomies (e.g. Project / Documents / Etc…) is it better to create them in the theme’s functions.php or within a plugin? [duplicate]

I think it depends on the case. If the taxonomy is essential part of the theme, then functions.php might be appropriate place for registering it. If the taxonomy doesn’t care which theme is in use on the site, then a custom plugin might be better place for it. Please note that asking about best practices … Read more