Skip to main content
2 of 3
added 51 characters in body
Milo
  • 78.9k
  • 4
  • 127
  • 168

Filters are for modifying data that's passed through them. You need to take the input, modify it, then return it.

function exclude_not_allowed_terms( $args ) {
    if(!current_user_can('edit_others_posts')) {
        $args['meta_query'] = array(
            array(
                'key'    => 'owner',
                'value'  => get_current_user_id()
            )
        );
    }
    return $args;
}
add_filter('get_terms_defaults','exclude_not_allowed_terms');
Milo
  • 78.9k
  • 4
  • 127
  • 168