How do I get posts which have publish date greater than 6 hours with wp query wordpress

i have tried the following code but it gives me posts within 6 hours of publish date.

$args = array(
'post_type' => 'epl_registration', 
'post_status'   => 'publish',
'fields' => 'ids',
'date_query'    => array(
     'after' => '6 hours ago'
     //'after' => '6 hours' //returns empty if used
 )
);
$the_query = new WP_Query( $args );

I need posts that are published 6 hours ago and not published within 6 hours

Read More

Please help

Related posts

1 comment

  1. Have you tried with “before”?

    $args = array(
    'post_type' => 'epl_registration', 
    'post_status'   => 'publish',
    'fields' => 'ids',
    'date_query'    => array(
         array(
             'column' => 'post_date_gmt',
             'before' => '6 hours ago'
         )
     )
    );
    $the_query = new WP_Query($args);
    

Comments are closed.