From 5eaee825f148ad6d271f6f2753ae21352122b004 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 8 Aug 2016 12:14:41 +0100 Subject: [PATCH] Ensure page_object is valid Closes #11641 --- includes/admin/wc-admin-functions.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/includes/admin/wc-admin-functions.php b/includes/admin/wc-admin-functions.php index 3f0fdbad604..45805de5405 100644 --- a/includes/admin/wc-admin-functions.php +++ b/includes/admin/wc-admin-functions.php @@ -62,9 +62,7 @@ function wc_create_page( $slug, $option = '', $page_title = '', $page_content = $option_value = get_option( $option ); - if ( $option_value > 0 ) { - $page_object = get_post( $option_value ); - + if ( $option_value > 0 && ( $page_object = get_post( $option_value ) ) ) { if ( 'page' === $page_object->post_type && ! in_array( $page_object->post_status, array( 'pending', 'trash', 'future', 'auto-draft' ) ) ) { // Valid page is already in place return $page_object->ID;