acp/search/is_active

This filter allows you to hide the smart filtering menu on the table screen for a specific user or post type.

Usage

add_filter( 'acp/search/is_active', function ( $is_active, \AC\ListScreen $list_screen ) {

	// Hides smart filtering on the page screen.
	$post_type = 'page';

	if ( $list_screen instanceof \AC\ListScreenPost && $post_type === $list_screen->get_post_type() ) {
		$is_active = false;
	}

	// Hides smart filtering on the taxonomy screen.
	if ( $list_screen instanceof \ACP\ListScreen\Taxonomy ) {
		$is_active = false;
	}

	// Hides smart filtering for ALL editors.
	$role = 'editor';

	if ( in_array( $role, wp_get_current_user()->roles ) ) {
		$is_active = false;
	}

	// Hides smart filtering for a specific user login.
	$login = 'admin';

	if ( ( $user = get_user_by( 'user_login', $login ) ) && get_current_user_id() === $user->ID ) {
		$is_active = false;
	}

	return $is_active;
}, 10, 2 );