Custom Callback Query?
-
I am looking for a way to limit the total number of posts returned by the query (not the # per page). Since there doesn’t seem to be an easy way to do this, I tried to create a custom callback function that would at least limit them going back 2 months. I tried creating this function (I assume that I put this in my functions.php?)
function qw_date_filter_callback($args, $filter){ $args = array( 'date_query' => array( array( 'after' => 'January 1st, 2018', 'before' => array( 'year' => 2018, 'month' => 3, 'day' => 28, ), 'inclusive' => true, ), ), ); return $args; }I tried using it as a filter in both a callback function and in the Post_ID filter like this:
function qw_date_filter_callback($args, $filter){ return $args; }As just a callback function I still get all of the posts. As a callback for the Post_IDs inclusive, I get no posts.
I must not understand how to use this function and I’m hoping someone might know.
Thanks
The topic ‘Custom Callback Query?’ is closed to new replies.