Support

Account

Home Forums General Issues Relationship Field Filter by \'last_name\' Reply To: Relationship Field Filter by \'last_name\'

  • Ugh… i did not format Approach #2 code… here that is:

    	add_filter('acf/fields/relationship/query/key=field_565de210b1c8c', 'exclude_staff', 10, 3);
    
    	function exclude_staff( $args, $field, $post )
    	
    		{
    			$args = array(
                                        'post_type' => 'dwb_directory',
                                        'meta_key' => 'last_name',
    	                            'orderby' => 'meta_value',
    	                            'order' => 'ASC',
    	                            'suppress_filters' => false,
    	                            'paged' => $paged,
                                     'meta_query' => array(
                                                array(
                                                     'key' => 'position_type',
                                                     'value'  => 'teacher',
                                                     'compare'  => 'LIKE'
                                        )
                                   )
                             );
    
     	      return $args;
    
    	}