WC_Admin_Permalink_Settings::get_shop_base_slug │ private │ WC 1.0

Resolve the Shop page URI that serves as the Shop base, or the default slug.

Shared by the render and the save paths so both resolve the base the same way.

wc_get_page_id() returns -1 when no page is set, so the ID is tested against zero rather than for truthiness -- and the page it names can still be gone, which get_post() catches.

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

Хуков нет.

Возвращает

string. Shop base slug.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_shop_base_slug( $shop_page_id ): string;
$shop_page_id(int) (обязательный)
Shop page ID, as resolved by wc_get_page_id( 'shop' ).

Код WC_Admin_Permalink_Settings::get_shop_base_slug() WC 11.3.0

private function get_shop_base_slug( int $shop_page_id ): string {
	return (string) ( ( $shop_page_id > 0 && get_post( $shop_page_id ) ) ? get_page_uri( $shop_page_id ) : _x( 'shop', 'default-slug', 'woocommerce' ) );
}