Support » Plugin: Custom Post Types and Custom Fields creator - WCK » cant search title or content

  • 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)
  • Plugin Author Gabriel Berzescu

    (@gabrielberzescu)

    Hello @justinblayney

    Sorry, but the development team does not have the resources to help with this.

    The recommended course of action is to find some professional for this.

    With best of wishes,
    Gabriel

    justinblayney

    (@justinblayney)

    I am the professional, so if the plugin authors cant fix it, or myself, then it must be concluded that you cannot do a keyword search users WCK custom post types..

    Plugin Author Gabriel Berzescu

    (@gabrielberzescu)

    Hi again,

    Development says that it should work as it is, with 's' => $this_key

    They say that they’ll give it a look later today and if that is the case, I will return with the result tomorrow.

    With best of regards,
    Gabriel

    Plugin Author madalin.ungureanu

    (@madalinungureanu)

    Hello,

    It seems to me that the query you wrote will find results only if the search word is present in the content AND in the meta query.

    Please take a look at this link https://wordpress.stackexchange.com/questions/78649/using-meta-query-meta-query-with-a-search-query-s
    It looks related to me to what you are trying to achieve.

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘cant search title or content’ is closed to new replies.