Support

Account

Home Forums General Issues Anniversary search Reply To: Anniversary search

  • I want to search for an anniversary within a certain time period. This code used to work, but it was updated to either PHP or WP, but now it returns 0 results. What’s wrong?

    $posts = get_posts(
       array(
          'numberposts'	=> 8,
          'post_type'		=> 'post',
          'meta_query' => array(
             'relation'		=> 'AND',
    	 array(
    	    'key'		=> 'evfordulo',
    	    'compare'	        => '>=',
                'value'		=> '[0-9]{4}'.date('md',strtotime("-10 days"))
        	 ),
        	 array(
    	    'key'		=> 'evfordulo',
    	    'compare'     	=> '<=',
    	    'value'		=> '[0-9]{4}'.date('md',strtotime("+10 days"))
    	 ),
         ),
       )
    );