One query to get posts and their taxonomy terms

According to user Otto, who provides a good explanatory answer to a similar question, you can safely call wp_get_post_terms() a number of times because WordPress’s internal query caching system is primed before the loop begins, and subsequent calls to wp_get_post_terms() will hit the cache rather than the query: Post meta information is automatically cached in … Read more

How To Assign “Taxonomy per Taxonomy”?

Essentially your issue is that you have extra data specific to the term and WP doesn’t natively store such data. On top of my head the low hanging ways to make it would be: Maintain the list of schools/colors and whenever school term is assigned automatically assign respective colors by code. Create term metadata tables … Read more

Creating a custom search form

Here’s an option. Give a more specific name e.g. custom_search_form to your submit button: (…) //First a submit button $output .= ‘<input type=”submit” class=”submit” name=”custom_search_form” id=”searchsubmit” value=”submit” />’.”\r\n”; Then you can add this to your functions.php file: add_action( ‘parse_request’, ‘my_custom_search_form’ ); function my_custom_search_form($query) { //return if it not our custom search form if ( ! … Read more

How do I taxonomy terms based on terms they are used alongside?

So my solution on this kind of problems where we have a very complex set of rules is to avoid doing new SQL just for my solution because if you have to explain it to a beginner it gets hairy. My solution: function get_term_union( $taxonomy, $tax_query, $post_type=”post” ){ $args = array( ‘post_type’ => $post_type, ‘tax_query’ … Read more

add taxonomy as one of menu items

Finally I was able to find a way to do exactly what I wanted. Though adding Custom Taxonomy or Custom Post Type can easily be added, while having its Template file, as following: Appearance> Menus > selecting Links widget > putting link of custom post type or taxonomy http://yourdomain.com/your-custom-post-or-taxonomy But also this answer help you … Read more

Get_terms stopped working after WP 4.2

I’ve got this fixed now. Managed to talk with my old developer and he added this: $termsById = array(); foreach ($terms as $t) { $termsById[$t->term_id] = $t; } I had to add this new variable where $terms was previously used on line 14. Thanks for your help everyone, I appreciate the effort.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)