Skip to content

Instantly share code, notes, and snippets.

@jconroy
Last active August 6, 2022 09:15

Revisions

  1. jconroy revised this gist Jul 15, 2020. 1 changed file with 14 additions and 1 deletion.
    15 changes: 14 additions & 1 deletion marketing-hub-disable.php
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,20 @@
    */

    /**
    * Remove marketing features - basic example to demonstrate usage
    * Option - Remove marketing features - basic example to demonstrate usage
    */
    add_filter(
    'woocommerce_admin_get_feature_config',
    function ( $features ) {
    $features['coupons'] = false;
    $features['marketing'] = false;

    return $features;
    }
    );

    /**
    * Option - Remove marketing features - basic example to demonstrate usage
    */
    add_filter( 'woocommerce_admin_features', 'disable_features' );

  2. jconroy revised this gist Jul 9, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion marketing-hub-disable.php
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ function disable_features( $features ) {
    }

    /**
    * Add/edit marketing hub menu item/s
    * Add/edit additional marketing hub menu item/s
    */
    //add_filter( 'woocommerce_marketing_menu_items', '__return_empty_array' );

  3. jconroy revised this gist Jul 9, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion marketing-hub-disable.php
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ function disable_features( $features ) {
    }

    /**
    * Remove marketing hub menu item/s
    * Add/edit marketing hub menu item/s
    */
    //add_filter( 'woocommerce_marketing_menu_items', '__return_empty_array' );

  4. jconroy revised this gist Jul 9, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion marketing-hub-disable.php
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    */

    /**
    * Remove marketing features
    * Remove marketing features - basic example to demonstrate usage
    */
    add_filter( 'woocommerce_admin_features', 'disable_features' );

  5. jconroy revised this gist Jul 9, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion marketing-hub-disable.php
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@ function disable_features( $features ) {
    /**
    * Remove marketing hub menu item/s
    */
    add_filter( 'woocommerce_marketing_menu_items', '__return_empty_array' );
    //add_filter( 'woocommerce_marketing_menu_items', '__return_empty_array' );

    /**
    * Remove wc-admin
  6. jconroy revised this gist Jul 9, 2020. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions marketing-hub-disable.php
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,20 @@
    * Plugin Name: Disable the WooCommerce Marketing Hub
    */

    /**
    * Remove marketing features
    */
    add_filter( 'woocommerce_admin_features', 'disable_features' );

    function disable_features( $features ) {
    $marketing = array_search('marketing', $features);
    unset( $features[$marketing] );
    //$coupons = array_search('coupons', $features);
    //unset( $features[$coupons] );
    //array_values( $features );
    return $features;
    }

    /**
    * Remove marketing hub menu item/s
    */
  7. jconroy revised this gist Apr 23, 2020. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions marketing-hub-disable.php
    Original file line number Diff line number Diff line change
    @@ -4,10 +4,11 @@
    */

    /**
    * Remove menu item/s
    * Remove marketing hub menu item/s
    */
    function poc_disable_marketing_hub( $marketing_pages ) {
    return array();
    }
    add_filter( 'woocommerce_marketing_menu_items', '__return_empty_array' );

    add_filter( 'woocommerce_marketing_menu_items', 'poc_disable_marketing_hub' );
    /**
    * Remove wc-admin
    */
    //add_filter( 'woocommerce_admin_disabled', '__return_true' );
  8. jconroy created this gist Apr 1, 2020.
    13 changes: 13 additions & 0 deletions marketing-hub-disable.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    <?php
    /**
    * Plugin Name: Disable the WooCommerce Marketing Hub
    */

    /**
    * Remove menu item/s
    */
    function poc_disable_marketing_hub( $marketing_pages ) {
    return array();
    }

    add_filter( 'woocommerce_marketing_menu_items', 'poc_disable_marketing_hub' );