WP Query | Type: PHPExclude Posts with a Particular Custom Field Value

You can exclude all posts that don’t have a particular custom field value. In this example, ‘events’ posts with event_type other than ‘Workshop’ will be displayed; workshops will not be displayed.

$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$today = date('Ymd', strtotime('-5 hours'));
$value = get_field('ev_enddate');
$eventslist = new WP_Query( array( 
     'post_type' => 'events', 
     'posts_per_page' => 6,
     'paged' => $paged,
     'meta_key' => 'ev_startdate',
     'orderby' => 'meta_value',
     'order' => 'ASC', //sort with soonest items at top
     'meta_query' => array(
          array(
          'key' => 'ev_enddate',
          //'meta-value' => $value,//error with PHP 8.3
          'value' => $today,
          'compare' => '>=',//only displays events not past end date
          'type' => 'CHAR'
          ),
          array(
          'key' => 'event_type',
          'value' => 'Workshop',
          'compare' => 'NOT LIKE', //excludes Workshop event types
          )
     )
) );