acf_is_screen()ACF 5.1.5

acf_is_screen

This function will return true if all args are matched for the current screen

No Hooks.

Returns

$post_id. (int)

Usage

acf_is_screen( $id );
$id
.
Default: ''

Changelog

Since 5.1.5 Introduced.

acf_is_screen() code ACF 6.8.8

function acf_is_screen( $id = '' ) {

	// bail early if not defined
	if ( ! function_exists( 'get_current_screen' ) ) {
		return false;
	}

	// vars
	$current_screen = get_current_screen();

	// no screen
	if ( ! $current_screen ) {
		return false;

		// array
	} elseif ( is_array( $id ) ) {
		return in_array( $current_screen->id, $id );

		// string
	} else {
		return ( $id === $current_screen->id );
	}
}