Write This Code On theme Function.php
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( 'plugin-folder-name/plugin-main-file.php' );
It’s working
Related Posts:
- How to check if a theme is active?
- Plugin Deactivate Self on Activation Errors
- Install theme as part of a plugin
- Disable plugin / plugin action via theme
- Where can I sell WordPress themes and plugins? [closed]
- Shared functionality in plugins and themes
- How to add favicon to my site – in both front end and admin panel
- Create theme files for plugin
- Reordering themes in admin panel
- Need to create a Theme demo site that features multiple themes
- How get list of updates of wp site?
- How can I list only sites that use a particular theme or plugin?
- disable active plugins for specific theme
- Should I use RIPS tool to test my themes and plugins?
- Make the css of the widget overwrite theme css
- Themes VS Plugins [duplicate]
- A way to sort WordPress themes? [closed]
- Can a WordPress plugin or theme contain a virus?
- WordPress site migration addvice
- Making menu link open in new tab?
- Auto add content such as pages upon plugin activation?
- add_meta_box (Will display only in specific page admin WordPress)
- How to automate wordpress plugin activate and deactivate by php logic?
- How to Know if a Plugin can be used with my Theme [closed]
- Not able to open category post [closed]
- Reusable functions and tools (Framework)
- Is any information available in PHP files in WP about plugin activation history?
- Only Homepage not loading properly
- Using custom JS plugins with WordPress?
- Activated plugin is stored as an object, rather than as a path
- Globally register styles but enqueue them selectively
- Admin Theme customization
- Run plugins only on certain pages
- (FES EDD) New vendor submission page is blank
- Are functions in main plugin file called before function bound to register_activation_hook runs?
- How to check if my wordpress websiste is nulled or not?
- Remove specific plugins and themes from the Dashboard->Updates page [duplicate]
- Create custom pages with a plugin
- Does heavy theme and plugins affect server’s response time? [closed]
- Proper way to use plugin functions in functions.php
- Theme Custom Pages
- how remove font to increase site speed load
- register_activation_hook() not working as expected
- Use $variable from file1.php in file2.php (different file paths)
- How to get theme’s info from wordpress.org/themes using api.wordpress.org?
- How to find the list of custom post type where logged in user is author
- What is the purpose of WP_CONTENT_URL?
- How can I use my custom wordpress theme on two websites? [closed]
- why need theme,if page builder is there in wordpress [closed]
- speed up pagination for huge database
- Apparent errer when installing plugin
- How to check homepage contain blog post?
- how to design change in woocommerce cart page and all other page also by theme? [closed]
- Is it possible for a plugin to prevent certain plugins from being installed?
- Activate a plugin via a SQL query
- How do you create a re-useable HTML fragment in wordpress
- plugin inside a wordpress theme
- Identify current wordpress theme
- Share plugins, themes, and multi post in a multidomain network
- Removing the custom_image_header from wp_head
- Gantry Framework: new page loads homepage content instead of page content
- use EDD Content Restriction for restricting php in template
- Activation flow of a plugin in a multisite environment
- Elementor pro page editing gives error There has been a critical error on this website. Please check your site admin email inbox for instructions
- Can’t load the the canges of field groups [duplicate]
- Javascript console errors and WSOD on edit post pages
- How Can I Create A Form In WordPress For Subscribers To Alert Them about new Listing posted?
- What plugin would make this happen? If is the theme
- WordPress site hamburger menu toggle not working
- WordPress wp get_temp_dir return non exiting folder, thus failing plugin & themes update
- Link custom post type to page
- How to disable a widget area of a specific page?
- when i activate my WordPress plugin cannot see customizer options or preview
- Writing SEO for Homepage when homepage is set to display latest posts
- Showing different js file for different theme in wordpress customizer api
- Getting unknown text in footer of email
- Seeking specific WordPress Layout
- Cannot modify header information – headers already sent during plugin activation
- Description: Too much time has passed without sending any data for document
- How can I make the search bar in my wordpress site search all of the pages rather than just the blog posts?
- WordPress Theme/Plugin Install (about FTP Connection)
- WordPress core update fails – no issues with plugin updates
- Why the output of an image gallery plugin is not displayed into a page of my custom theme?
- How to add the functionality of WordPress needed to be installed to be mandatory while installing themes
- Incentive theme – Getting ’You do not have sufficient permissions’ while trying to install plugins
- How do I make the selected layout display for all MarketPress pages?
- Problems with installing and deleting plugins
- Issues with Post 2 Post Plugin
- Plugin De/Activation Not Firing On MultiSite install
- Disqus plugin outputs script as literal text
- Can’t get custom user meta to show in header
- How to get current template file used by WordPress?
- How to make only selected posts appear on a selected wordpress page
- Terms id wordpress error
- How to add a plugin in WordPress theme directory?
- WP Customer Reviews call short code on another page [closed]
- How to make wordpress backend mobile optimized.?
- Editing a theme
- What is phpBB? Is it something like a plugin which I can use in WordPress? [closed]
- Very slow page loads