wc_get_page_id( string $page )
Retrieve page ids – used for myaccount, edit_address, shop, cart, checkout, pay, view_order, terms. returns -1 if no page is found.
Description #Description
Parameters #Parameters
- $page
-
(Required) Page slug.
Return #Return
(int)
Source #Source
File: includes/wc-page-functions.php
function wc_get_page_id( $page ) { if ( 'pay' === $page || 'thanks' === $page ) { wc_deprecated_argument( __FUNCTION__, '2.1', 'The "pay" and "thanks" pages are no-longer used - an endpoint is added to the checkout instead. To get a valid link use the WC_Order::get_checkout_payment_url() or WC_Order::get_checkout_order_received_url() methods instead.' ); $page = 'checkout'; } if ( 'change_password' === $page || 'edit_address' === $page || 'lost_password' === $page ) { wc_deprecated_argument( __FUNCTION__, '2.1', 'The "change_password", "edit_address" and "lost_password" pages are no-longer used - an endpoint is added to the my-account instead. To get a valid link use the wc_customer_edit_account_url() function instead.' ); $page = 'myaccount'; } $page = apply_filters( 'woocommerce_get_' . $page . '_page_id', get_option( 'woocommerce_' . $page . '_page_id' ) ); return $page ? absint( $page ) : -1; }
Related #Related
Uses #Uses
Uses | Description |
---|---|
includes/wc-deprecated-functions.php: wc_deprecated_argument() |
Wrapper for deprecated arguments so we can apply some extra logic. |
includes/wc-page-functions.php: woocommerce_get_{$page}_page_id |
WooCommerce Page Functions |
Used By #Used By
Used By | Description |
---|---|
includes/blocks/class-wc-blocks-utils.php: WC_Blocks_Utils::get_all_blocks_from_page() |
Get blocks from a woocommerce page. |
includes/wc-template-functions.php: wc_page_no_robots() |
Disable search engines indexing core, dynamic, cart/checkout pages. |
packages/woocommerce-blocks/src/Assets/AssetDataRegistry.php: AssetDataRegistry::get_store_pages() |
Get store pages to include in settings. |
includes/wc-update-functions.php: wc_update_200_permalinks() |
Update permalinks for 2.0 |
includes/customizer/class-wc-shop-customizer.php: WC_Shop_Customizer::add_checkout_section() |
Checkout section. |
includes/class-wc-cache-helper.php: WC_Cache_Helper::prevent_caching() |
Prevent caching on certain pages |
includes/admin/settings/class-wc-settings-advanced.php: WC_Settings_Advanced::get_settings() |
Get settings array. |
includes/admin/class-wc-admin-permalink-settings.php: WC_Admin_Permalink_Settings::settings() |
Show the settings. |
includes/admin/class-wc-admin-permalink-settings.php: WC_Admin_Permalink_Settings::settings_save() |
Save the settings. |
includes/admin/class-wc-admin-post-types.php: WC_Admin_Post_Types::show_cpt_archive_notice() |
Show a notice above the CPT archive. |
includes/admin/class-wc-admin-post-types.php: WC_Admin_Post_Types::add_display_post_states() |
Add a post display state for special WC pages in the page list table. |
includes/admin/class-wc-admin-post-types.php: WC_Admin_Post_Types::hide_cpt_archive_templates() |
When editing the shop page, we should hide templates. |
includes/admin/class-wc-admin-menus.php: WC_Admin_Menus::admin_bar_menus() |
Add the “Visit Store” link in admin bar main menu. |
includes/class-wc-template-loader.php: WC_Template_Loader::init() |
Hook in methods. |
includes/class-wc-template-loader.php: WC_Template_Loader::get_template_loader_default_file() |
Get the default filename for a template. |
includes/class-wc-breadcrumb.php: WC_Breadcrumb::add_crumbs_shop() |
Shop breadcrumb. |
includes/class-wc-breadcrumb.php: WC_Breadcrumb::generate() |
Generate breadcrumb trail. |
includes/class-wc-breadcrumb.php: WC_Breadcrumb::prepend_shop_page() |
Prepend the shop page to shop breadcrumbs. |
includes/wc-core-functions.php: flush_rewrite_rules_on_shop_page_save() |
Flushes rewrite rules when the shop page (or it’s children) gets saved. |
includes/wc-core-functions.php: wc_fix_rewrite_rules() |
Various rewrite rule fixes. |
includes/wc-conditional-functions.php: is_view_order_page() |
Is_view_order_page – Returns true when on the view order page. |
includes/wc-conditional-functions.php: is_edit_account_page() |
Check for edit account page. |
includes/wc-conditional-functions.php: is_order_received_page() |
Is_order_received_page – Returns true when viewing the order received page. |
includes/wc-conditional-functions.php: is_add_payment_method_page() |
Is_add_payment_method_page – Returns true when viewing the add payment method page. |
includes/wc-conditional-functions.php: is_lost_password_page() |
Is_lost_password_page – Returns true when viewing the lost password page. |
includes/wc-conditional-functions.php: is_account_page() |
Is_account_page – Returns true when viewing an account page. |
includes/wc-conditional-functions.php: is_cart() |
Is_cart – Returns true when viewing the cart page. |
includes/wc-conditional-functions.php: is_checkout() |
Is_checkout – Returns true when viewing the checkout page. |
includes/wc-conditional-functions.php: is_shop() |
Is_shop – Returns true when viewing the product type archive (shop). |
includes/class-wc-post-types.php: WC_Post_Types::register_post_types() |
Register core post types. |
includes/gateways/cod/class-wc-gateway-cod.php: WC_Gateway_COD::is_available() |
Check If The Gateway Is Available For Use. |
includes/class-wc-install.php: WC_Install::create_pages() |
Create pages that the plugin relies on, storing page IDs in variables. |
includes/class-wc-install.php: WC_Install::is_new_install() |
Is this a brand new WC install? |
includes/wc-template-functions.php: wc_page_noindex() |
Disable search engines indexing core, dynamic, cart/checkout pages. |
includes/wc-template-functions.php: woocommerce_product_archive_description() |
Show a shop page description on product archives. |
includes/wc-template-functions.php: woocommerce_page_title() |
Page Title function. |
includes/wc-template-functions.php: wc_terms_and_conditions_page_id() |
Get the terms and conditons page ID. |
includes/wc-template-functions.php: wc_template_redirect() |
Handle redirects before content is output – hooked into template_redirect so is_page works. |
includes/class-wc-download-handler.php: WC_Download_Handler::check_download_login_required() |
Check if a download requires the user to login first. |
includes/abstracts/abstract-wc-widget.php: WC_Widget::get_current_page_url() |
Get current page URL with various filtering props supported by WC. |
includes/class-wc-tracker.php: WC_Tracker::get_cart_checkout_info() |
Get info about the cart & checkout pages. |
includes/wc-deprecated-functions.php: woocommerce_get_page_id() | |
includes/class-wc-query.php: WC_Query::wpseo_metadesc() |
WP SEO meta description. |
includes/class-wc-query.php: WC_Query::wpseo_metakey() |
WP SEO meta key. |
includes/class-wc-query.php: WC_Query::pre_get_posts() |
Hook into pre_get_posts to do the main product query. |
includes/wc-page-functions.php: wc_nav_menu_item_classes() |
Fix active class in nav for shop page. |
includes/wc-page-functions.php: wc_list_pages() |
Fix active class in wp_list_pages for shop page. |
includes/wc-page-functions.php: wc_get_page_permalink() |
Retrieve page permalink. |
includes/class-wc-coupon.php: WC_Coupon::get_coupon_error() |
Map one of the WC_Coupon error codes to a message string. |
includes/wc-account-functions.php: wc_lostpassword_url() |
Returns the url to the lost password endpoint url. |
packages/woocommerce-admin/src/API/OnboardingTasks.php: OnboardingTasks::get_homepage_cover_block() |
Returns a valid cover block with an image, if one exists, or background as a fallback. |
packages/woocommerce-admin/src/Loader.php: Loader::add_component_settings() |
Hooks extra neccessary data into the component settings array already set in WooCommerce core. |