• Hello. I add “Dynamic data and time” query – https://i.imgur.com/i0oWT0o.png all looks like right, but records not shown….

    If I get post by code:

    
    <?php
    $today = current_time('Ymd');
    
    $args = array(
      'post_type'      => 'product',
      'posts_per_page' => -1,
      'post_status'    => 'publish',
      'meta_query'     => array(
        array(
          'key'     => 'date_start',
          'value'   => array( date( $today), date( 'Ymd', strtotime( '+10 days' ) ) ),
          'compare' => 'BETWEEN',
          'type'    => 'DATE'
        ) 
      )
    );
    
    // The Query
    $the_query = new WP_Query( $args );
    
    // The Loop
    if ( $the_query->have_posts() ) {
      echo '<ul>';
      while ( $the_query->have_posts() ) {
        $the_query->the_post();
        echo '<li>' . get_the_title() . '</li>';
      }
      echo '</ul>';
    } else {
      // no posts found
    }
    /* Restore original Post Data */
    wp_reset_postdata();
    

    – the posts successful showed

    where I mistake?

    Thx

  • The topic ‘Not work “Dynamic data and time”’ is closed to new replies.