enqueue() public method

Enqueue the hooks associated with the webhook.
Since: 2.2
public enqueue ( )
Esempio n. 1
0
 /**
  * Load & enqueue active webhooks
  *
  * @since 2.2
  */
 private function load_webhooks()
 {
     if (false === ($webhooks = get_transient('woocommerce_webhook_ids'))) {
         $webhooks = get_posts(array('fields' => 'ids', 'post_type' => 'shop_webhook', 'post_status' => 'publish', 'posts_per_page' => -1));
         set_transient('woocommerce_webhook_ids', $webhooks);
     }
     foreach ($webhooks as $webhook_id) {
         $webhook = new WC_Webhook($webhook_id);
         $webhook->enqueue();
     }
 }
Esempio n. 2
0
 /**
  * Load & enqueue active webhooks
  *
  * @since 2.2
  */
 public function load_webhooks()
 {
     $args = array('fields' => 'ids', 'post_type' => 'shop_webhook', 'post_status' => 'publish');
     $query = new WP_Query($args);
     if (!empty($query->posts)) {
         foreach ($query->posts as $id) {
             $webhook = new WC_Webhook($id);
             $webhook->enqueue();
         }
     }
 }