how do i remove posts from a WP_Query so the pagination is right?

Rather than querying all posts and then only displaying those that match the criteria, query for posts that match the criteria. WP_Query allows you to do just that with its meta-key/meta-value attributes. For instance, to get posts where the custom field unreleased is to ‘false’, somewhere before the loop: global $wp_query; $customField = array( ‘meta_key’ … Read more

Including Custom Meta with posts_where query

Well I managed to solve this sort of… The answer was to use separate search input boxes for each custom field being searched. Here is my working solution if anyone ever stumbles across this. function display_all_products() { global $term; $term = trim(strip_tags($_POST[‘s’])); $refnoterm = trim(strip_tags($_POST[‘ref’])); $yrterm = trim(strip_tags($_POST[‘yr’])); if(!empty($_POST[‘s’]) || !empty($_POST[‘ref’]) || !empty($_POST[‘yr’])) { if(!empty($_POST[‘s’])) … Read more

WP Query Returning All Posts

I think you’re confusing old meta parameters with new meta_query parameters. meta_key should be just key and meta_value should be just value. Refer to WP_Query in Codex for correct syntax. Also, print_r( $country_query ); will show you the actual SQL query being sent to the database and will show you where you’re going wrong.