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

WC_REST_System_Status_V2_Controller::get_pages() public WC 1.0

Returns a mini-report on WC pages and if they are configured correctly: Present, visible, and including the correct shortcode.

{} Это метод класса: WC_REST_System_Status_V2_Controller{}

Возвращает

Массив.

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

$WC_REST_System_Status_V2_Controller = new WC_REST_System_Status_V2_Controller();
$WC_REST_System_Status_V2_Controller->get_pages();

Код WC_REST_System_Status_V2_Controller::get_pages() WC 4.7.1

<?php
public function get_pages() {
	// WC pages to check against.
	$check_pages = array(
		_x( 'Shop base', 'Page setting', 'woocommerce' ) => array(
			'option'    => 'woocommerce_shop_page_id',
			'shortcode' => '',
		),
		_x( 'Cart', 'Page setting', 'woocommerce' ) => array(
			'option'    => 'woocommerce_cart_page_id',
			'shortcode' => '[' . apply_filters( 'woocommerce_cart_shortcode_tag', 'woocommerce_cart' ) . ']',
		),
		_x( 'Checkout', 'Page setting', 'woocommerce' ) => array(
			'option'    => 'woocommerce_checkout_page_id',
			'shortcode' => '[' . apply_filters( 'woocommerce_checkout_shortcode_tag', 'woocommerce_checkout' ) . ']',
		),
		_x( 'My account', 'Page setting', 'woocommerce' ) => array(
			'option'    => 'woocommerce_myaccount_page_id',
			'shortcode' => '[' . apply_filters( 'woocommerce_my_account_shortcode_tag', 'woocommerce_my_account' ) . ']',
		),
		_x( 'Terms and conditions', 'Page setting', 'woocommerce' ) => array(
			'option'    => 'woocommerce_terms_page_id',
			'shortcode' => '',
		),
	);

	$pages_output = array();
	foreach ( $check_pages as $page_name => $values ) {
		$page_id            = get_option( $values['option'] );
		$page_set           = false;
		$page_exists        = false;
		$page_visible       = false;
		$shortcode_present  = false;
		$shortcode_required = false;

		// Page checks.
		if ( $page_id ) {
			$page_set = true;
		}
		if ( get_post( $page_id ) ) {
			$page_exists = true;
		}
		if ( 'publish' === get_post_status( $page_id ) ) {
			$page_visible = true;
		}

		// Shortcode checks.
		if ( $values['shortcode'] && get_post( $page_id ) ) {
			$shortcode_required = true;
			$page               = get_post( $page_id );
			if ( strstr( $page->post_content, $values['shortcode'] ) ) {
				$shortcode_present = true;
			}
		}

		// Wrap up our findings into an output array.
		$pages_output[] = array(
			'page_name'          => $page_name,
			'page_id'            => $page_id,
			'page_set'           => $page_set,
			'page_exists'        => $page_exists,
			'page_visible'       => $page_visible,
			'shortcode'          => $values['shortcode'],
			'shortcode_required' => $shortcode_required,
			'shortcode_present'  => $shortcode_present,
		);
	}

	return $pages_output;
}