Stop hook webhooks when is not configured the hooks and delivery URL

This commit is contained in:
Claudio Sanches 2014-12-16 20:16:38 -02:00
parent 9f83541d9f
commit 4c47def638
1 changed files with 4 additions and 3 deletions

View File

@ -83,9 +83,10 @@ class WC_Webhook {
* @since 2.2
*/
public function enqueue() {
foreach ( $this->get_hooks() as $hook ) {
add_action( $hook, array( $this, 'process' ) );
if ( is_array( $this->get_hooks() ) && ! empty( $this->get_delivery_url() ) ) {
foreach ( $this->get_hooks() as $hook ) {
add_action( $hook, array( $this, 'process' ) );
}
}
}