Automatically Activate WordPress Plugins programmatically

Today, We want to share with you Automatically Activate WordPress Plugins programmatically .In this post we will show you How to Activate Plugins & Themes Upon WordPress Installation, hear for automatically install plugins with themes for wordpress we will give you demo and example for implement.In this post, we will learn about How to Programmatically & Automatically Download, Install, Activate & Replace WordPress Plugins with an example.

Automatically Activate WordPress Plugins programmatically

There are the Following The simple About Activate WordPress Plugins programmatically Full Information With Example and source code.

Read Also:  insert Query In Codeigniter Example Tutorial

As I will cover this Post with live Working example to develop wordpress activate plugin from database, so the automated wordpress installation script for this example is following below.

simple create a WordPress stores the main active Plugins in the store all the data in database table options, field call a activate_plugins

// wordpress example on admin side control panel init, control informat register_activation_hook() 
add_action( 'admin_init', 'google_activate_plugins' );
// the exmple function
function google_activate_plugins() {
  
  if ( ! current_user_can('activate_plugins') )
    wp_die(__('We do not have full fill permissions to activate plugins for this wordpress web site.'));
  $plugins = FALSE;
  $plugins = get_option('active_plugins'); // get active plugins
  
  if ( $plugins ) {
    // your plugins to active
    $pugins_to_active = array(
      'hello.php', // first plugin Hello Dolly
      'adminimize/adminimize.php', //second plugin name Adminimize
      'akismet/akismet.php' //third plugin name Akismet
    );
    
    foreach ( $pugins_to_active as $plugin ) {
      if ( ! in_array( $plugin, $plugins ) ) {
        array_push( $plugins, $plugin );
        update_option( 'active_plugins', $plugins );
      }
    }
    
  } // end if $plugins

}

The following simple PHP wordpress function as well as its hook give a direct results of the string of the Plugin file on the wordpress Plugin page in your admin side backend, therefor please use it only for a quick data all the wordpress plugin finding.

Read Also:  Check all checkboxes in HTML table using jQuery

add_filter( 'plugin_row_meta', 'google_get_plugin_string', 10, 4 );
function google_get_plugin_string( $plugin_meta, $plugin_file, $plugin_data, $status ) {
  // print plugin file string
  echo '<pre>' . $plugin_file . '</pre><br>';
  return $plugin_meta;
}

Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Automatically Activate WordPress Plugins programmatically .
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Read Also:  How to get selected value of dropdown in JavaScript/jQuery on change?

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  WordPress Plugin Redirect After Activation
  2. Read Also:  Angular 6 CLI Installation Tutorial With Example
  3. Read Also:  How to delete session Data in Laravel blade file?
  4. Read Also:  C# Named and Optional Arguments Tutorial with Examples
  5. Read Also:  SQL Not Equal Operator introduction and examples
  6. Read Also:  Jquery simple rating system with star
  7. Read Also:  Drag And Drop Multiple File Uploading using DropzoneJS and PHP Example
  8. Read Also:  int to string c++
  9. Read Also:  Pure CSS custom checkboxes
  10. Read Also:  WordPress Plugin Redirect After Activation
CLOSEX