Forums Forums Search & Filter Pro Custom WP Query & offset parameter

Tagged: , ,

  • This topic has 4 replies, 3 voices, and was last updated 2 years ago by Anonymous.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Anonymous
    #264253

    Hey Trevor,

    I use a custom WP_Query and everything work great. But the minute i try to offset the query by 1 i get only part results while they are duplicates. Any idea why?

    Thanks,
    Roee

    Trevor
    #264256

    Our plugin does not use wp_query in the normal way. Instead it passes a string of matching Post IDs using post__in, so anything you code in to a page’s wp_query arguments is likely to fail, as we ignore most of them, and some that you might add might break our plugin. As such, we do not support a post offset.

    Anonymous
    #264258

    Appreciate the answer – any workaround you might think of? i thought just hiding the first item but then i get to a weird situation as i want to set 12 posts per page via your plugin.

    look – https://forter2020.wpengine.com/blog/

    Any suggestion?

    Thanks,
    Roee

    Trevor
    #264260

    This might help. V3 is a few months away yet.

    Anonymous
    #276695

    Why not use the Edit Query Arguments Filter?
    https://searchandfilter.com/documentation/action-filter-reference/
    /////////////////
    function filter_function_name( $query_args, $sfid ) {
    if($sfid==12345)
    {
    //modify $query_args here before returning it
    //$query_args[‘somearg’] = ‘newvalue’;
    $query_args[‘offset’] = ‘1’;
    }
    return $query_args;
    }
    add_filter( ‘sf_edit_query_args’, ‘filter_function_name’, 20, 2 );

Viewing 5 posts - 1 through 5 (of 5 total)