Exclude drafts from the "Shop page" select (ref #24136)

This commit is contained in:
Knyazevich 2020-10-06 06:30:53 +03:00
parent df60bfb054
commit f551c6c792
1 changed files with 10 additions and 0 deletions

View File

@ -286,6 +286,15 @@ class WC_Settings_Products extends WC_Settings_Page {
);
} else {
$draft_pages = get_posts(
array(
'post_type' => 'page',
'post_status' => 'draft',
'fields' => 'ids',
'posts_per_page' => -1,
)
);
$settings = apply_filters(
'woocommerce_product_settings',
apply_filters(
@ -304,6 +313,7 @@ class WC_Settings_Products extends WC_Settings_Page {
'id' => 'woocommerce_shop_page_id',
'type' => 'single_select_page',
'default' => '',
'args' => array( 'exclude' => $draft_pages ),
'class' => 'wc-enhanced-select-nostd',
'css' => 'min-width:300px;',
'desc_tip' => __( 'This sets the base page of your shop - this is where your product archive will be.', 'woocommerce' ),