Query to fetch custom taxonomy along with post title

If we want to display taxonomy name along with post title in backend MYSQL query you can use this query :- SELECT p.ID,taxonomy,post_title,post_status,name FROM wp_posts p, wp_term_relationships rel, wp_terms t, wp_term_taxonomy te where p.ID = rel.object_id AND t.term_id=te.term_id AND t.term_id=rel.term_taxonomy_id AND taxonomy in (‘taxonomy’) AND Post_type=”post” and name=”name of taxonomy”

Shortcode with loop stacks output

Ok…So, I was able to find an example that helped: function faq() { $output=””; $query = new WP_Query( ‘post_type=faqs’ ); if ( $query -> have_posts() ) : while ( $query -> have_posts() ) : $query -> the_post(); $output .= ‘<h3>’.get_the_title().'</h3>’; $output .= ‘<p>’.get_the_content().'</p>’; endwhile; endif; wp_reset_postdata(); return $output; } add_shortcode( ‘faqs’, ‘faq’ ); This puts … Read more

Join Query on WP_USERMETA Table

function get_users_email ($time_zone_cont, $class_group){ // Add Lisa’s user id, 14, in an array. $exclude_list = array( ); $Time_Zone = $time_zone_cont; $user_class_group = $class_group; $args = array( // ‘role’ => ‘Editor’, // ‘exclude’ => $exclude_list, ‘meta_query’ => array( // ‘relation’ => ‘OR’, array( ‘key’ => ‘Time_Zone’, ‘value’ => $Time_Zone, ‘compare’ => ‘=’ ), array( ‘key’ => … Read more

Display data from phpMyAdmin with WordPress

if you are trying to query from the same database in which your WordPress is installed then there is a great way to do sql query with ease. WordPress has a database access abstraction class called wpdb that allows you to run raw mysql query without any issue. You can start using it like one … Read more

How to sort by two meta keys in admin area?

I can’t find any examples that combine the $query->set(‘property’, ‘value’) syntax with an array assuming that’s the correct method In your $args array, you defined both meta_query and orderby as arrays, and they are each an arg for WP_Query (or a value for the “property” above), hence in your custom function (set_post_order_in_admin()), just use $query->set( … Read more