• Resolved justinblayney

    (@justinblayney)


    Hello,

    I am coding a custom WordPress query, I want my keyword field to search post title, content and meta_queries.. The meta_query portion is working fine, but it isn’t searching title and content. here is my code

    $args = array (
        'post_type'			=>'resources',
        'post_status'       => 'publish',
    	'posts_per_page'    => 100,
        'order'      => 'ASC',
        's' => $this_key,
        'meta_query' => 
    	
               array(
    			'relation' => 'OR',
    				
    			array(
    				'key'     => 'agency',
    				'value'   => $this_key ,
    				'compare' => 'LIKE'
       				 ),
    			array(
    				'key'     => 'available_form',
    				'value'   => $this_key,
    				'compare' => 'LIKE'
    			)
    		
    	)
    
    );

    I also tried writing it these ways with no luck

    's' => $this_key,
    's' => ''.$this_key.'',
     's'     => '' . esc_attr( $this_key ) . '',
     's'     => '*' . esc_attr( $this_key ) . '*',
    'search' => $this_key,
    'search' => ''.$this_key.'',
    'search'     => '' . esc_attr( $this_key ) . '',
     'search'     => '*' . esc_attr( $this_key ) . '*',
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘cant search title or content’ is closed to new replies.