Exclude a WordPress post from pre_get_posts if a field is null

@Howdy_McGee – Thanks for pointing me in the right direction. Below is the code I used. By the way, I know that the FacetWP plugin can be a little particular with queries. In case anyone is wondering, this works with it.

function set_posts_per_page_for_attorneys_cpt( $atty ) {
  if ( !is_admin() && $atty->is_main_query() && is_post_type_archive( 'attorneys' ) ) {

  $meta_query = array(array(
    'key'=>'last_name',
  ));

  $meta_query = $atty->get('meta_query');

  //filter out people without a particular key
  $meta_query = array(array(
    'key'=>'title_group',
    'value'=>'',
    'compare'=>'!=',
  ));

  //update the query
  $atty->set( 'orderby', $meta_key);
  $atty->set( 'order', 'ASC' );
  $atty->set( 'meta_query',$meta_query );
  $atty->set( 'posts_per_page', '-1' );
  $atty->set( 'facetwp', true);
  }
}
add_action( 'pre_get_posts', 'set_posts_per_page_for_attorneys_cpt' );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)