Wp Query custom search by meta query

I did it this way: $name = explode(‘ ‘, $name); foreach($name as $string) { $args[‘meta_query’][] = array( ‘key’ => ‘name’, ‘value’ => $string, ‘compare’ => ‘LIKE’ ); } Which works good, but I’m not sure if that’s the best solution.

Filter and Order by Multiple Custom Meta Values

For multiple meta value you have to use “IN” $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘shows’, ‘orderby’ => ‘meta_value_num’, ‘meta_key’ => ‘start_date’, ‘order’ => ‘ASC’, ‘meta_query’ => array( array( ‘key’ => ‘show_location’, ‘value’ => array(‘second’,’third’), ‘compare’ => ‘IN’ ) ) ); // get results $the_query = new WP_Query( $args ); The IN comparison … Read more

Sanitize Custom Field Value in Meta Query

The strtotime() function is what you need here: $date = date( ‘Y-m-d’, strtotime( $date ) ); //2015-04-10 with your example Note that you will need to do this when you save those values, not when running the query. You can’t convert data that’s already in the database on the fly when running a query. Edit: … Read more

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