ACF_Ajax_Check_Screen::get_page_template_arg │ protected │ ACF 6.8.11

Returns a submitted page template if it is one the post can use, or null.

The block editor sends an empty template for the default template.

Метод класса: ACF_Ajax_Check_Screen{}

Хуков нет.

Возвращает

string|null.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_page_template_arg( $post, $page_template );
$post(WP_Post) (обязательный)
The post being edited.
$page_template(разное) (обязательный)
The submitted page template.

Список изменений

С версии 6.8.11 Введена.

Код ACF_Ajax_Check_Screen::get_page_template_arg() ACF 6.8.11

protected function get_page_template_arg( $post, $page_template ) {
	if ( ! is_string( $page_template ) ) {
		return null;
	}

	if ( in_array( $page_template, array( '', 'default' ), true ) || array_key_exists( $page_template, wp_get_theme()->get_page_templates( $post, $post->post_type ) ) ) {
		return $page_template;
	}

	return null;
}