Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Retrieve WPshowposts by meta key value (a date) compared to DateTime(now) Reply To: Retrieve WPshowposts by meta key value (a date) compared to DateTime(now)

#20033
Tom
Keymaster

Hi there,

You may need to filter the query itself.

First, install the latest testing version here: https://wpshowposts.com/wp-show-posts-1-2-0/

Then you can do this:

add_filter( 'wpsp_query_args', function( $args, $settings ) {
    if ( 123 === (int) $settings['list_id'] ) {
        $args['meta_key'] = 'acnb_live_date';
        $args['value'] = date( 'Y-m-d' ),
        $args['compare'] = 'compare_date';
        $args['type'] = 'date';
    }

    return $args;
}, 10, 2 );

You just need to change the 123 to the ID of your list, then you have full control over the query.