• monsurvey2

    (@monsurvey2)


    Hi,
    I’m trying to create a buddy press component, I want to retrieve posts based on custom filed using meta_query of the get_posts word press functions from an ajax function in buddy press component ajax file,
    I wrote my $args as flowing:

    $args = array(
    
    ‘s’=>$keyword ,
    
    ‘post_type’ => ‘businesspost’,
    ‘post_status’ => array(‘publish’),
    ‘orderby’ => ‘post_date’,
    ‘showposts’=>10,
    
    ‘meta_query’ => array(
    array(‘key’ => ‘_offertype’, ‘value’ => ‘sellofer’
    ) )
    );
    $posts=get_posts($args);

    If i delete the meta_query it gives posts fine, but when i add the meta query it gives nothing, I’m sure that my custom field key and value are correct.
    please some one helping me.

The topic ‘I need help in get_posts function with ajax file’ is closed to new replies.