ACF_Admin::ensure_submenu_selectionpublicACF 6.1

Ensure the correct ACF submenu item is selected when in post-new versions of edit pages

Method of the class: ACF_Admin{}

No Hooks.

Returns

string. The modified submenu filename

Usage

$ACF_Admin = new ACF_Admin();
$ACF_Admin->ensure_submenu_selection( $submenu_file );
$submenu_file(string) (required)
The submenu filename.

Changelog

Since 6.1 Introduced.

ACF_Admin::ensure_submenu_selection() code ACF 6.8.8

public function ensure_submenu_selection( $submenu_file ) {
	if ( ! is_string( $submenu_file ) ) {
		return $submenu_file;
	}
	if ( strpos( $submenu_file, 'post-new.php?post_type=acf-' ) === 0 ) {
		return str_replace( 'post-new', 'edit', $submenu_file );
	}
	return $submenu_file;
}