Merge pull request #13057 from thenbrent/fix_undefined_index

Fix undefined index notice in WC_Webhook:: should_deliver()
This commit is contained in:
Mike Jolley 2017-02-03 10:59:36 +01:00 committed by GitHub
commit 8a0761fdf5
1 changed files with 2 additions and 2 deletions

View File

@ -139,12 +139,12 @@ class WC_Webhook {
$should_deliver = false;
} elseif ( in_array( $current_action, array( 'delete_post', 'wp_trash_post' ), true ) ) {
// Only deliver deleted event for coupons, orders, and products.
if ( ! in_array( $GLOBALS['post_type'], array( 'shop_coupon', 'shop_order', 'product' ) ) ) {
if ( isset( $GLOBALS['post_type'] ) && ! in_array( $GLOBALS['post_type'], array( 'shop_coupon', 'shop_order', 'product' ) ) ) {
$should_deliver = false;
}
// Check if is delivering for the correct resource.
if ( str_replace( 'shop_', '', $GLOBALS['post_type'] ) !== $this->get_resource() ) {
if ( isset( $GLOBALS['post_type'] ) && str_replace( 'shop_', '', $GLOBALS['post_type'] ) !== $this->get_resource() ) {
$should_deliver = false;
}
} elseif ( 'delete_user' == $current_action ) {