[2.6] Drafts don't have post_date_gmt
Fixes #11686 @claudiosmweb @justinshreve
This commit is contained in:
parent
5d5222d3e1
commit
f7958f2b20
|
@ -160,8 +160,11 @@ class WC_Webhook {
|
||||||
// creation date to determine the actual event
|
// creation date to determine the actual event
|
||||||
$resource = get_post( absint( $arg ) );
|
$resource = get_post( absint( $arg ) );
|
||||||
|
|
||||||
|
// Drafts don't have post_date_gmt so calculate it here
|
||||||
|
$gmt_date = get_gmt_from_date( $resource->post_date );
|
||||||
|
|
||||||
// a resource is considered created when the hook is executed within 10 seconds of the post creation date
|
// a resource is considered created when the hook is executed within 10 seconds of the post creation date
|
||||||
$resource_created = ( ( time() - 10 ) <= strtotime( $resource->post_date_gmt ) );
|
$resource_created = ( ( time() - 10 ) <= strtotime( $gmt_date ) );
|
||||||
|
|
||||||
if ( 'created' == $this->get_event() && ! $resource_created ) {
|
if ( 'created' == $this->get_event() && ! $resource_created ) {
|
||||||
$should_deliver = false;
|
$should_deliver = false;
|
||||||
|
|
Loading…
Reference in New Issue