sprouter-nate
7/23/2019 - 2:42 PM

Upcoming Events - cast date as integer

add_filter( 'posts_where' , 'func_posts_where' );
function func_posts_where( $where ) {
 
global $wpdb;
global $WP_Views;
 
     if(in_array($WP_Views->current_view, array(485))){	//the ID of each "wp_view" this applies to.  Multiple views, separate ID's by commas
         
          $where = str_replace("CAST(mt1.meta_value AS SIGNED)","UNIX_TIMESTAMP(mt1.meta_value)",$where);	//NOTE:  'mt1' is set by the WP View as the first filter added for a custom field.  if a filter is added before the "_EventStartDate" - this will be mt2 or other...
       
     }
    return $where;
}