WP_query mit OR-Beziehung zwischen args und arg

Ich muss eine “OR” -Beziehung zwischen args [‘s’] und args [‘meta_query’] erstellen. Wenn ich definiere

‘relation’ => “ODER” innerhalb der Liste der Arrays generiert es immer noch die SQL mit UND-Beziehung.

Code-Snippet folgt

if( isset($_GET['resume_search_keyword']) && $_GET['resume_search_keyword'] != '' ) : $resume_args['s'] = $_GET['resume_search_keyword']; endif; $resume_search_skills = array( 'key' => '_resume_skills', 'value' => $_GET['resume_search_keyword'], 'compare' => 'LIKE' ); $resume_search_job_duties = array( 'key' => '_resume_job_duties', 'value' => $_GET['resume_search_keyword'], 'compare' => 'LIKE' ); $resume_args['meta_query'] = array( 'relation' => "OR", $resume_search_job_duties, $resume_search_skills ); $resumes = new WP_Query($resume_args); 

Das sql, das für dasselbe erzeugt wird, ist wie folgt

 SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1 = 1 AND (((wp_posts.post_title LIKE '%teaching%') OR (wp_posts.post_excerpt LIKE '%teaching%') OR (wp_posts.post_content LIKE '%teaching%'))) AND ((wp_postmeta.meta_key = '_resume_job_duties' AND wp_postmeta.meta_value LIKE '%teaching%') OR (wp_postmeta.meta_key = '_resume_skills' AND wp_postmeta.meta_value LIKE '%teaching%')) AND wp_posts.post_type = 'resume' AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 3 AND wp_posts.post_status = 'private') 

Wonach ich suche, ist

 SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1 = 1 AND (((wp_posts.post_title LIKE '%teaching%') OR (wp_posts.post_excerpt LIKE '%teaching%') OR (wp_posts.post_content LIKE '%teaching%'))) **OR** ((wp_postmeta.meta_key = '_resume_job_duties' AND wp_postmeta.meta_value LIKE '%teaching%') OR (wp_postmeta.meta_key = '_resume_skills' AND wp_postmeta.meta_value LIKE '%teaching%')) AND wp_posts.post_type = 'resume' AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 3 AND wp_posts.post_status = 'private') 

Kann mir bitte jemand helfen, wo ich falsch liege?

Solutions Collecting From Web of "WP_query mit OR-Beziehung zwischen args und arg"

Versuche dies:

 $query = new WP_Query( array( 'meta_query' => array( 'relation' => 'OR', 'resume_skills_clause' => array( 'key' => '_resume_skills', 'value' => $_GET['resume_search_keyword'], 'compare' => 'LIKE' ), 'resume_job_duties_clause' => array( 'key' => "_resume_job_duties", 'value' => $_GET['resume_search_keyword'], 'compare' => 'LIKE' ) ) ));