问题
I'd like to know how to get the page which set as "Terms & Conditions Page" on "Appearance > Customize > WooCommerce > Checkout" on WordPress admin.
I could get privacy policy page with "is_privacy_policy()", but don't know how to get "Terms & Conditions Page".
I want to do this to make a plugin for WooCommerce not just for me but any person, so I can not know its page slug.
Thank you.
回答1:
First terms and conditions WordPress page need to be defined in WooCommerce Settings > Advanced > Terms and conditions field…
Then you can get the "terms and conditions" page ID (and page) using:
$page_id = wc_terms_and_conditions_page_id();
$page = $page_id ? get_post( $page_id ) : false;
来源:https://stackoverflow.com/questions/63333105/how-to-get-terms-conditions-page-id-in-woocommerce