Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function my_posts_where( $where ) {
- $where = str_replace("meta_key = 'document_%", "meta_key LIKE 'document_%", $where);
- return $where;
- }
- add_filter('posts_where', 'my_posts_where');
- $args = array(
- 'numberposts' => -1,
- 'post_type' => 'course',
- 'meta_query' => array(
- 'relation' => 'AND',
- array(
- 'key' => 'document_%_type',
- 'value' => $document,
- 'compare' => 'IN'
- ),
- array(
- 'key' => 'form_of_edu',
- 'value' => $form_of_edu,
- 'compare' => 'IN'
- ),
- array(
- 'key' => 'type',
- 'value' => $type,
- 'compare' => 'IN'
- )
- )
- );
- $query = new WP_Query( $args );
- $arr = $query->posts;
- print_r($arr);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement