Support

Account

Home Forums General Issues Querying post with a date picker filed older than 15 days

Unread

Querying post with a date picker filed older than 15 days

  • Hey, guys!

    I have a date picker field and I am trying to query posts with this date older than 15 days.
    I came up with some code, but the thing is that is not working accurate. I shal be very greatfull if someone can provide some help.

    Here is my code:

    
    $date_args = array(
            'post_type'   => 'bransamente',
            'meta_key' => 'data_depunere_bs',
            'posts_per_page' => -1,
            'orderby' => 'meta_value_num',
            'order' => 'ASC',
    		'tax_query' =>  array (
    		    array(
          			'taxonomy' => 'status_bransament', 
    			    'terms' => 'bransament-rezolvat', 
          			'field' => 'slug', 
          			'operator' => 'NOT IN', 
        		),
      		),
            'meta_query'=> array(
                array(
                  'key' => 'data_depunere_bs',
                  'compare' => '<=',
                  'value' => date("j F Y", strtotime("-15 days")),
                  'type' => 'DATE'
                )
            ),
        );
    

    Thanks in advance.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.