Advertisement
sandy1000

Untitled

Oct 27th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. function eg_remove_my_subscriptions_button( $actions, $subscription ) {
  2.     global $wp_query;
  3.     $cat_id = $wp_query->get_queried_object()->term_id; // get current category id
  4.  
  5.     if($cat_id == 11) { // check if we're in the category
  6.                 foreach ( $actions as $action_key => $action ) {
  7.             switch ( $action_key ) {
  8.                 case 'change_payment_method':   // Hide "Change Payment Method" button?
  9.     //          case 'change_address':      // Hide "Change Address" button?
  10.     //          case 'switch':          // Hide "Switch Subscription" button?
  11.     //          case 'resubscribe':     // Hide "Resubscribe" button from an expired or cancelled subscription?
  12.     //          case 'pay':         // Hide "Pay" button on subscriptions that are "on-hold" as they require payment?
  13.     //          case 'reactivate':      // Hide "Reactive" button on subscriptions that are "on-hold"?
  14.     //          case 'cancel':          // Hide "Cancel" button on subscriptions that are "active" or "on-hold"?
  15.                     unset( $actions[ $action_key ] );
  16.                     break;
  17.                 default:
  18.                     error_log( '-- $action = ' . print_r( $action, true ) );
  19.                     break;
  20.             }
  21.         }
  22.  
  23.     }
  24.     return $actions;
  25. }
  26. add_filter( 'wcs_view_subscription_actions', 'eg_remove_my_subscriptions_button', 100, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement