Title: Change plugin option from function.php
Last modified: October 13, 2016

---

# Change plugin option from function.php

 *  [bkseen](https://wordpress.org/support/users/bkseen/)
 * (@bkseen)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/change-plugin-option-from-function-php/)
 * Hi there,
 * For my website I’m using the plugin [Woocommerce Variations to Table Grid](https://codecanyon.net/item/woocommerce-variations-to-table-grid/10494620),
   but I would like to restrict this one only for some roles ‘Administrator’ and‘
   wholesaler’. (my website is for wholesalers and ‘normal’ customer)
 * Anyway I was thinking to just desactivate the plugin by checking the user role
   so I tried the following solution : [http://wordpress.stackexchange.com/questions/159085/deactivate-plugin-for-a-specific-user-group](http://wordpress.stackexchange.com/questions/159085/deactivate-plugin-for-a-specific-user-group)
   
   Doesn’t work.
 * I’ve got a variable in my plugin called $vartable_disabled which is a boolean
   which “Disable globally” the plugin.
 * So I am thinking to do something in my functions.php like:
 *     ```
       add_action('admin_init', 'my_option_change_plugins');    
       function my_option_change_plugins()
       {
           global $current_user;
           if (!in_array('administrator' || 'wholesaler', $current_user->roles)) {
               deactivate_plugins( // activate for variation-table
       			$vartable_disabled == 0
                               $vartable_position == 'under'
               );
           } else { // desactivate for those than can't use it
               activate_plugins(
       			$vartable_disabled == 1
                               $vartable_position == 'side'
               );
           }
       ```
   
 * But for sure I’m doing something wrong, I tried plenty of different thing the
   whole day, impossible to figure it out.
 * Anyone can help?
 * Cheers 🙂

Viewing 1 replies (of 1 total)

 *  Thread Starter [bkseen](https://wordpress.org/support/users/bkseen/)
 * (@bkseen)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/change-plugin-option-from-function-php/#post-8308035)
 * bump!

Viewing 1 replies (of 1 total)

The topic ‘Change plugin option from function.php’ is closed to new replies.

## Tags

 * [function.php](https://wordpress.org/support/topic-tag/function-php/)
 * [variation](https://wordpress.org/support/topic-tag/variation/)

 * 1 reply
 * 1 participant
 * Last reply from: [bkseen](https://wordpress.org/support/users/bkseen/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/change-plugin-option-from-function-php/#post-8308035)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
