Creating Custom Query

Try following codes: $country_search_array = array(); while($row = mysql_fetch_array($regionresult)){ $country_search_array[] = $row[‘country’]; // Your country field name } $country_search = “‘”.implode(“‘,”, $country_search_array).”‘”; $args = array( ‘posts_per_page’ => -1, ‘meta_query’ => array( array( ‘key’ => ‘Country’, ‘value’ => $country_search, ‘compare’ => ‘IN’ ) ) ); $query = new WP_Query( $args );

Query author’s posts & posts that have author’s id as meta value

Instead of a new WP_Query, use the pre_get_posts filter add_filter(‘pre_get_posts’, ‘custom_query’); function custom_query($query) { if($query->is_main_query() && $query->is_author() && $_GET[‘eco’]==’somemetakey’) { $query->set(‘meta_query’, array( array( ‘key’ => ‘somemetakey’, ‘value’ => $query->get(‘author’) ) )); } }

loop through custom post-type with two meta_keys

You’ll need to use meta_query along with meta_(key|value|compare) to interact with two different keys and get the order you want. <?php $q = new WP_Query(array( ‘post_type’ => ‘my_project’, ‘nopaging’ => true, // same as posts_per_page => 1, ‘order’ => $order, ‘orderby’ => ‘is_featured_position’, // your position key here ‘meta_key’ => ‘is_featured_position’, // also here, see … Read more

Filtering problem

… I will need to be more specific, by adding a “%” after $author (James). The problem is that this will not work at all. Any idea why? The % is a wildcard with a MySQL LIKE query, which I suspect you know. With meta queries, WordPress will add one to the beginning and one … Read more

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