acf_get_options_pages()ACF 1.0

Хуки из функции

Возвращает

null. Ничего (null).

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

acf_get_options_pages();

Код acf_get_options_pages() ACF 6.0.4

function acf_get_options_pages() {

	// global
	global $_wp_last_utility_menu;

	// vars
	$pages = acf_options_page()->get_pages();

	// bail early if no pages
	if ( empty( $pages ) ) {
		return false;
	}

	// apply filter to each page
	foreach ( $pages as $slug => &$page ) {

		$page = acf_get_options_page( $slug );

	}

	// calculate parent => child redirectes
	foreach ( $pages as $slug => &$page ) {

		// bail early if is child
		if ( $page['parent_slug'] ) {
			continue;
		}

		// add missing position
		if ( ! $page['position'] ) {

			$_wp_last_utility_menu++;
			$page['position'] = $_wp_last_utility_menu;

		}

		// bail early if no redirect
		if ( ! $page['redirect'] ) {
			continue;
		}

		// vars
		$parent = $page['menu_slug'];
		$child  = '';

		// update children
		foreach ( $pages as &$sub_page ) {

			// bail early if not child of this parent
			if ( $sub_page['parent_slug'] !== $parent ) {
				continue;
			}

			// set child (only once)
			if ( ! $child ) {
				$child = $sub_page['menu_slug'];
			}

			// update parent_slug to the first child
			$sub_page['parent_slug'] = $child;

		}

		// finally update parent menu_slug
		if ( $child ) {
			$page['menu_slug'] = $child;
		}
	}

	// filter
	$pages = apply_filters( 'acf/get_options_pages', $pages );

	// return
	return $pages;

}