Filter posts by multiple checkbox categories

I thing, you should use this code for filter the check box category <?php // cat 42=Laos cat 57=2-4Days <?php $my_query_1 = new WP_query(array(‘category__and’ => array(42,57))); ?> <?php while ($my_query_1->have_posts()) : $my_query_1->the_post(); ?> <a href=”https://wordpress.stackexchange.com/questions/100169/<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?><?php the_excerpt(); ?></a> <?php endwhile; ?>

How to create a list of terms who’s posts also have a predefined external term?

if i understand correctly you want to get a list of albums (posts) of a specific artist(taxonomy) and that are have ihaveit term. if so the its a simple query using tax_query: $args = array( ‘posts_per_page’ => -1, //get all ‘post_type’ => ‘album’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘artist’, ‘field’ => … Read more

Joining tables not working in the post editor page

The easy way in the admin is to do a 2nd custom query using the post_id from the post object. function custom_posts_data( $posts, $query ) { global $wpdb; if ( !count( $posts ) ) return $posts; while ( $posts as $post ) { $query = “SELECT * FROM {$wpdb->prefix}my_plugin_table WHERE post_id={$post->ID}”; $results = $wpdb->get_results( $query … Read more

Taxonomy search filters

You could make use of add_query_arg() and remove_query_arg() here. For example http://yourdomain.com/?country=india&institute=pune-university would show results of Pune University in India. You could add s=symbiosis to search in the filtered results too. Basically this url would help you out -> http://codex.wordpress.org/Function_Reference/add_query_arg

Filter dashboard custom post listing by user

pre_get_posts is correct. the code from will prevent any non-admin from seeing anyone else’s posts. http://blog.rutwick.com/display-only-the-posts-authored-by-the-current-wp-user-on-the-posts-page-in-the-back-end to limit that to only 1 post type you’d add in one more condition and check $typenow == ‘your_custom_post_type’: add_action(‘pre_get_posts’, ‘filter_posts_list’); function filter_posts_list($query) { //$pagenow holds the name of the current page being viewed global $pagenow, $typenow; //$current_user uses … Read more