Title: Combining multiple plugins into one
Last modified: August 22, 2016

---

# Combining multiple plugins into one

 *  Resolved [KirillTaylor](https://wordpress.org/support/users/kirilltaylor/)
 * (@kirilltaylor)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/combining-multiple-plugins-into-one/)
 * Hi,
 * I’ve got some 5-6 plugins which deliver certain bonus upon purchase (via woocommerce).
   
   1 basic class which others extend to. I’ve had an idea running them in a certain
   order within the basic class using a custom hook. My question is: is it possible
   to fire actions using something like this? `add_action( 'my_custom_hook', array(
   $className, 'my_method'));`
 * (couldn’t find any documentation or code examples for this)
 * Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Ryan Sechrest](https://wordpress.org/support/users/sovereign/)
 * (@sovereign)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/combining-multiple-plugins-into-one/#post-5605027)
 * I’m assuming that `$className` is not an instance of the class, but rather just
   the name, right? In other words, this will be called statically?
 * If so, on the [`add_action`](https://wordpress.org/support/topic/combining-multiple-plugins-into-one/codex.wordpress.org/Function_Reference/add_action?output_format=md#Using_with_a_Class)
   WordPress documentation page it states the following:
 * > If the class is called statically the approach has to be like below as $this
   > is not available. This also works if class is extended. Use the following:
 *     ```
       class MyPluginClass {
   
           public static function init() {
   
                add_action( 'save_post', array( get_called_class(), 'myplugin_save_posts' ) );
           }
   
           public static function myplugin_save_posts() {
                // do stuff here...
           }
       }
   
       MyPluginClass::init();
       ```
   
 * This would lead me to believe that it is possible.
 *  Thread Starter [KirillTaylor](https://wordpress.org/support/users/kirilltaylor/)
 * (@kirilltaylor)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/combining-multiple-plugins-into-one/#post-5605095)
 * Thanks,
 * That’s not exactly the way I had imagined it. I did solve the issue, though. 
   Non-static class, in the constructor, different hooks for different methods within
   the class. Such as
 *     ```
       function __construct(){
            add_action('hook1', 'method1');
            add_action('hook2', 'method6');
            add_action('hook3', 'method3');
       }
       ```
   
 * Thanks for the help anyway 😛

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Combining multiple plugins into one’ is closed to new replies.

## Tags

 * [action](https://wordpress.org/support/topic-tag/action/)
 * [classes](https://wordpress.org/support/topic-tag/classes/)
 * [combined](https://wordpress.org/support/topic-tag/combined/)
 * [multiple](https://wordpress.org/support/topic-tag/multiple/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [KirillTaylor](https://wordpress.org/support/users/kirilltaylor/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/combining-multiple-plugins-into-one/#post-5605095)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
