woocommerce_new_webhook_data

The WooCommerce woocommerce new webhook data hook.

Description

apply_filters( 'woocommerce_new_webhook_data', (callback) $data_name, (unknown) $data, (unknown) $instance ); 

Parameters (3)

0. $data_name — Optional. (callback) => array( 'post_type' => 'shop_webhook', 'post_status' => 'publish', 'ping_status' => 'closed', 'post_author' => get_current_user_id(), 'post_password' => strlen( ( $password = uniqid( 'webhook_' ) ) ) > 20 ? substr( $password, 0, 20 ) : $password, 'post_title' => ! empty( $data['name'] ) ? $data['name'] : sprintf( __( 'Webhook created on %s', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Webhook created on date parsed by strftime', 'woocommerce' ) ) ), )
The array.
1. $data (unknown)
The data.
2. $instance (unknown)
The instance.

Usage

To run the hook, copy the example below.
  1. $data_name = apply_filters( 'woocommerce_new_webhook_data', $data_name, $data, $instance ); 
  2.  
  3. if ( !empty( $data_name ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_new_webhook_data callback 
  2. function filter_woocommerce_new_webhook_data( $data_name, $data, $instance ) { 
  3. // make filter magic happen here... 
  4. return $data_name
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_new_webhook_data', 'filter_woocommerce_new_webhook_data', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_new_webhook_data', 'filter_woocommerce_new_webhook_data', 10, 3 ); 

Defined (2)

The filter is defined in the following location(s).

/includes/api/legacy/v3/class-wc-api-webhooks.php  
  1. $webhook_data = apply_filters( 'woocommerce_new_webhook_data', array( 
/includes/api/legacy/v2/class-wc-api-webhooks.php  
  1. $webhook_data = apply_filters( 'woocommerce_new_webhook_data', array(