WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Theme::get_page_templates() WP 3.4.0

Returns the theme's post templates for a given post type.

Это метод класса: WP_Theme

Хуки из метода
Возвращает

Массив. Array of page templates, keyed by filename, with the value of the translated header name.

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

$WP_Theme = new WP_Theme();
$var = $WP_Theme->get_page_templates( $post, $post_type );
$post(WP_Post/null)
The post being edited, provided for context.
По умолчанию: null
$post_type(строка)
Post type to get the templates for. If a post is provided, its post type is used.
По умолчанию: 'page'

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

С версии 3.4.0 Введена.
С версии 4.7.0 Added the $post_type parameter.

Код WP Theme::get page templates: wp-includes/class-wp-theme.php WP 5.2.4

<?php
public function get_page_templates( $post = null, $post_type = 'page' ) {
	if ( $post ) {
		$post_type = get_post_type( $post );
	}

	$post_templates = $this->get_post_templates();
	$post_templates = isset( $post_templates[ $post_type ] ) ? $post_templates[ $post_type ] : array();

	/**
	 * Filters list of page templates for a theme.
	 *
	 * @since 4.9.6
	 *
	 * @param string[]     $post_templates Array of page templates. Keys are filenames,
	 *                                     values are translated names.
	 * @param WP_Theme     $this           The theme object.
	 * @param WP_Post|null $post           The post being edited, provided for context, or null.
	 * @param string       $post_type      Post type to get the templates for.
	 */
	$post_templates = (array) apply_filters( 'theme_templates', $post_templates, $this, $post, $post_type );

	/**
	 * Filters list of page templates for a theme.
	 *
	 * The dynamic portion of the hook name, `$post_type`, refers to the post type.
	 *
	 * @since 3.9.0
	 * @since 4.4.0 Converted to allow complete control over the `$page_templates` array.
	 * @since 4.7.0 Added the `$post_type` parameter.
	 *
	 * @param string[]     $post_templates Array of page templates. Keys are filenames,
	 *                                     values are translated names.
	 * @param WP_Theme     $this           The theme object.
	 * @param WP_Post|null $post           The post being edited, provided for context, or null.
	 * @param string       $post_type      Post type to get the templates for.
	 */
	$post_templates = (array) apply_filters( "theme_{$post_type}_templates", $post_templates, $this, $post, $post_type );

	return $post_templates;
}