• Resolved mouseuser

    (@mouseuser)


    I am trying to do query posts by limiting to posts that have a certain time set. I am using a WP_Query but comparing by time doesn’t work because the text_time is stored as text like 18:30 PM. Any ideas how I can adjust the query or the setup so I can do this? Code so far is

    'post_type' => 'floatroutes',
        'meta_query' => array(
            array(
              'key' => '_time',
              'value' => date('g:i A', strtotime('-30 minutes')),
              'compare' => '<='
              )
          )
      );
      $myquery= new WP_Query( $args );

    Any ideas how this could be achieved, given that I need to display the time at the front end like 18:30 etc?

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Limit query by CMB2 time?’ is closed to new replies.