• Resolved AmberKayle

    (@amberkayle)


    I am trying to hook into activate_plugin.

    I know that activate_plugin has 1 required param and 2 optional ones. I am trying to acquire all 3.

    Here’s my setup:

    // create plugin settings menu
    add_action('admin_menu', 'pe_create_menu');
    
    function pe_create_menu() {
    
      //create new sub-level menu
      add_submenu_page( 'plugins.php', 'Plugin Settings', 'Plugin Enabler', 'administrator', __FILE__, 'pe_settings_page' );
    
      // Add my hook
      add_action( 'activate_plugin', 'pe_network_activate', 10, 3 );
    }

    And my function:

    function pe_network_activate( $plugin, $redirect = '', $network_wide = false ) {
      $args = var_export( func_get_args(), true);
      _log("Args: " . $args); // write to the WP error_log
    }

    $args returns only the first parameter. How do I get all 3?

    My goal is to be able to tell when a plugin is being network activated, or just normally activated – hence the need for $network_wide.

Viewing 1 replies (of 1 total)
  • Thread Starter AmberKayle

    (@amberkayle)

    Found out that activate_plugin accepts 3 args, but the action only emits 1.

    Going to monitor update_site_option.

Viewing 1 replies (of 1 total)
  • The topic ‘How to get all of the activate_plugin action parameters?’ is closed to new replies.