title: Visual Composer Post Grid Custom Query Today Date
body: <p>I'm using visual composer by <a href="http://vc.wpbakery.com/" rel="nofollow">http://vc.wpbakery.com/</a> on my wordpress site.
  My issue is within the custom query of the post grid.</p>
  
  <p>Basically I'm selecting all upcoming events (post type event) where the event-end-date (custom field) is >= today.</p>
  
  <p>My query string (unescaped):</p>
  
  <pre><code>paged=1&amp;posts_per_page=-1&amp;offset=0&amp;post_status=publish&amp;ignore_sticky_posts=0&amp;orderby=meta_value&amp;order=DESC&amp;post_type[event]=event&amp;meta_key=event-end-date&amp;meta_query[0][key]=event-end-date&amp;meta_query[0][value]=2016-09-20&amp;meta_query[0][compare]=&gt;=&amp;meta_query[0][type]=DATE
  </code></pre>
  
  <p>The thing that bums me out is that the today date is set fixed to: 2016-09-20.
  Now everytime an event passes I manually have to update this date so that the event isn't represented in the upcoming list any more.</p>
  
  <p>Is there a possibility to set a changing value like today's date in a wordpress query string? </p>
  
  <p>VC only allows me to insert a query string so I can't work with variables, except there is some sort of mechanism which allows me replace some template-keyword with the current date.</p>
  
  <p>Or is there some other way how I can filter the upcoming events, like using tags, post meta values, etc...?</p>
  
  <p><strong>-- Solved --</strong></p>
  
  <ul>
  <li>update events every 12 hours</li>
  <li>update events if saved</li>
  </ul>
  
  <p>functions.php</p>
  
  <pre><code>add_filter('cron_schedules', 'my_cron_schedules');
  function my_cron_schedules( $schedules ) {
      $schedules['halfday'] = array(
          'interval' =&gt; 43200,
          'display' =&gt; __('halfday')
      );
      return $schedules;
  }
  
  if ( !wp_next_scheduled( 'my_halfday_event' ) ) {
      wp_schedule_event( time(), 'halfday', 'my_halfday_event' );
  }
  add_action('my_halfday_event', 'update_events');
  
  function save_event( $post_id ) {
      $post_type = get_post_type( $post_id );
      if ( $post_type != 'event' ) {
          return;
      }
      update_events();
  }
  add_action( 'save_post', 'save_event' );
  
  function update_events() {
      $events = get_posts( array(
          'posts_per_page' =&gt; -1,
          'post_type' =&gt; 'event'
      ) );
      foreach( $events as $event ) {
          $event_end_date = get_post_field( 'event-end-date', $event-&gt;ID );
          if ( is_wp_error( $event_end_date ) ) {
              continue;
          }
          $today = current_time('Y-m-d');
          $event_expired = $event_end_date &lt; $today ? 'true' : 'false';
          $event_updated = current_time('Y-m-d H:i:s');
          update_post_meta($event-&gt;ID, 'event-expired', $event_expired);
          update_post_meta($event-&gt;ID, 'event-updated', $event_updated);
      }
  }
  </code></pre>
  
  <p>new query</p>
  
  <pre><code>paged=1&amp;posts_per_page=-1&amp;offset=0&amp;post_status=publish&amp;ignore_sticky_posts=0&amp;orderby=meta_value&amp;order=DESC&amp;post_type%5Bevent%5D=event&amp;meta_key=event-end-date&amp;meta_query%5B0%5D%5Bkey%5D=event-expired&amp;meta_query%5B0%5D%5Bvalue%5D=false&amp;meta_query%5B0%5D%5Bcompare%5D=%3D&amp;meta_query%5B0%5D%5Btype%5D=CHAR
  </code></pre>