Support

Account

Home Forums General Issues Query Post Type and Repeater field =>Sub Field date

Solved

Query Post Type and Repeater field =>Sub Field date

  • Hello,

    I done a query width sub field repeater date.
    My query works perfectly, but in the meta query date (subfield), he don’t want to show result width = in the compare.

    I am looking for the good pratice ta have only results when the meta query is = only today. Is it a format date problème ?

    When i tried it this meta query like it (he don’t work):
    array(
    ‘key’ => ‘commentaires_$_date_de_rappel’,
    ‘compare’ => ‘=’,
    ‘value’ => $date,
    ),

    My Query :
    $date = date(‘dmY’);
    $yesterday = date(‘dmY’,strtotime($date1 . “-1 days”));
    // args
    $args = array(
    ‘numberposts’ => -1,
    ‘post_type’ => ‘entreprise’,
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘commentaires_$_date_de_rappel’,
    ‘compare’ => ‘>=’,
    ‘value’ => $yesterday,
    ),
    array(
    ‘key’ => ‘commentaires_$_date_de_rappel’,
    ‘compare’ => ‘>=’,
    ‘value’ => $date,
    ),
    array(
    ‘key’ => ‘commentaires_$_date_de_rappel’,
    ‘compare’ => ‘NOT IN’,
    ‘value’ => ”,
    ),
    )
    );

    $query99 = new WP_Query( $args );
    if ( $query99->have_posts() ) {
    while ( $query99->have_posts() ) {
    }
    }
    wp_reset_postdata();

    Thank you for your help. I will be apprecied !

  • Thank you so much Jhon … It’s work !

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.