Search
Close this search box.

Activate WordPress Plugin FTP

Contents

We come across an issue in wordpress site where the plugin page was not opening and all we wanted to do is activate a plugin and fix the bugs in client site. 

Luckily, we had FTP access and activated the required plugin using the following plugin. It is simple, just follow the steps:

  1. Identify the activated theme
    1. If its your own site you probably know the active theme on site if not just open the chrome inspector and goto sources tab and wp-content and you will get the name of active wordpress theme.
  2. Open functions.php of active wordpress theme
  3. Paste the following code at the end of functions.php file
  4. You must know the plugin directory name and plugin main php file name that you want to activate.
  5. Simply enter the directory and php file name at the end of following code
  6. refresh the wp-admin and vola your desired plugin is activated via FTP.
  7. Good!!
function run_activate_plugin( $plugin ) { 
    $current = get_option( 'active_plugins' ); 
    $plugin = plugin_basename( trim( $plugin ) ); 

    if ( !in_array( $plugin, $current ) ) { 
        $current[] = $plugin; sort( $current ); 
        do_action( 'activate_plugin', trim( $plugin ) ); 
        update_option( 'active_plugins', $current ); 
        do_action( 'activate_' . trim( $plugin ) ); 
        do_action( 'activated_plugin', trim( $plugin) ); 
    } 
    return null; 
} 
    
run_activate_plugin( 'your-plugin-directory/your-plugin-main-file.php' );

Hope this tutorial is helpful to you, kindly share. Thanks.

Having issue? comment below or click here to contact us

Leave a Reply

Your email address will not be published. Required fields are marked *

Picture of Hafiz Faraz Mukhtar

Hafiz Faraz Mukhtar

Hafiz Faraz Mukhtar is an expert Web Developer, SEO specialist, and Graphic Designer. Hafiz Faraz is an expert in WordPress design and development. Hire on Upwork | Hire on Fiverr