acf_third_party::pts_allowed_pages()publicACF 5.0.0

pts_allowed_pages

This filter will prevent PTS from running on the field group page!

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

Хуков нет.

Возвращает

$pages.

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

$acf_third_party = new acf_third_party();
$acf_third_party->pts_allowed_pages( $pages );
$pages (обязательный)
-

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

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

Код acf_third_party::pts_allowed_pages() ACF 6.0.4

function pts_allowed_pages( $pages ) {

	// vars
	$post_type = '';

	// phpcs:disable WordPress.Security.NonceVerification.Recommended -- Verified elsewhere.
	// check $_GET because it is too early to use functions / global vars.
	if ( ! empty( $_GET['post_type'] ) ) {

		$post_type = sanitize_text_field( $_GET['post_type'] );

	} elseif ( ! empty( $_GET['post'] ) ) {

		$post_type = get_post_type( $_GET['post'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized when get_post_type() calls get_post().

	}
	// phpcs:enable WordPress.Security.NonceVerification.Recommended
	// check post type
	if ( $post_type == 'acf-field-group' ) {

		$pages = array();

	}

	// return
	return $pages;

}