MU plugins don’t ‘activate’, or ‘deactivate’. They’re just present or not present. So you’ll need a different approach. One option would be to just perform your activation functions on init
, and store a record in the database to say whether or not it’s already been done:
function activate_mjmc_core() {
if ( '1' === get_option( 'mjmc_activated' ) ) {
return;
}
require_once plugin_dir_path( __FILE__ ) . 'includes/class-mjmc-core-activator.php';
Mjmc_Core_Activator::activate();
Mjmc_Core_Activator::mjmc_database_version();
Mjmc_Core_Activator::mjmc_companies_table();
Mjmc_Core_Activator::mjmc_locations_table();
Mjmc_Core_Activator::mjmc_companies_insert();
update_option( 'mjmc_activated', '1' );
}
add_action( 'init', 'activate_mjmc_core' );
Related Posts:
- Auto Load Plugin Hooks inside Must Use Plugin
- How to use a Must-Use plugin to hide a regular one and to hide itself?
- wp_get_environment_type is undefined
- Certain functions are undefined when called form mu-plugins
- Notice: Uninitialized string offset: 0 in social sharing mu-plugin
- How to update mu-plugin
- Are mu-plugins plugins still deployed via wordpress.org/plugins?
- Must use Plugin not updating HTML code in head
- How can woocommerce be used in mu-plugins folder?
- “Disable” specific plugins on certain pages
- Using mu-plugins on the Genesis Framework
- What Are the Advantages of Using an mu-plugin
- How to use a Must-Use plugin to hide a regular one and to hide itself?
- Define constant for one plugin in mu-plugin
- Unable to access WPadmin, website down
- Is it bad practice to create own table for a plugin?
- WordPress 5.3 update causes media library file upload to break – Cannot convert undefined or null to object
- What plugins do you commonly install on a fresh WordPress install?
- Publish author posts only with editor approval?
- how to change default icon of custom plugin?
- List of all existing WordPress plugins
- All shortcodes not working on custom theme
- How to work with Syntax Highlighter Evolved?
- WordPress Admin is displaying Not Available
- How to remove/hide action links cluttering under specific plugins’ names
- How to develop a community feature in the dashboard for multiauthor site
- Which hook should be used to validate custom form fields on the login form?
- Using the media uploader in a custom plugin
- Plugin child folder?
- Converting a simple plugin to be placed inside of functions.php
- How to delete terms on plugin deactivate?
- Showing Notifications While Activating Plugin
- How can I filter the contents of a metafield before it’s displayed in the admin?
- register_post_status invisible but searchable
- How can I get the post content displayed in a text field that allows to edit posts?
- Is it not recommendable to stick with plugins that are no longer supported by the author for production sites?
- greatest() function returns undefined property
- Is there a way to programmatically enable a plugin?
- Override WooCommerce page-specific js in my theme
- Should i delete the posts created by a plugin on uninstall?
- Calling JavaScript file with Custom Plugin
- Convert existing WordPress Site (with several plugins) into Multisite
- Image gallery plugin [closed]
- Where sales manager of WP-Commerce plugin?
- Custom Field Template seriously messed up in WP 3.1.1
- How can I get WordPress to save comments in markdown format?
- Not able to complete meta box save function and sanitization/validation
- Access WordPress database outside of WordPress
- Prevent WordPress installing plugins and themes via Admin
- Is there a way to set the default active tab on Post UI Tab pluggin?
- Generate pages from markdown files in github automatically
- Woocommerce Create custom product type with variations
- Shortcode Plugin to dynamically build a shortcode via `do_shortcode` not working
- Perform internal redirect in WordPress?
- Using AJAX to generate front end / viewer end pages
- How to prevent plugins from loading jQuery
- How to remove admin main menu name repetition
- WP plugins for Product web catalog [closed]
- User Signup in Multisite – Need Plugin or Advice
- Plugin – Social media share buttons
- How to deploy gutenberg on my own [closed]
- Adding Static Image to WooCommerce Content-Single-Product template
- How to protect WordPress from security scanner [closed]
- how can I query all wordpress users of a blog
- Automate paragraphs in a post page to have a unique anchor link
- Error in pdf generating plugin using FPDF
- How to create WordPress custom end point with multiple parameters?
- Text change in Advanced Customs Fields [closed]
- After updating the WordPress getting a syntax error in the console
- How to redirect to same page after form submission
- How to add a new column with text fields to WooCommerce Cart List?
- How to use filter to disable adding a product to wishlist?
- How to use apply_filters?
- Call a function for social sharing
- How to find the WordPress Nextgen galleries which are not used in WordPress posts?
- How to get authors who have added the post in the specific custom post type
- Get product categories and add them to a custom taxonomy
- I want to add the below chatbot html code to index(main) file of WordPress sites how can I do that
- Mobile Menu and Mobile Sidebar missing
- Changing the CSS with a plugin
- How come W3TC is allowed to host premium code in the WordPress repo?
- What are the disadvantages of using template_redirect for restrictions
- Passing function into add_action always returns the first argument
- Circular Menu to show on pages
- Unable to to self-deactivate plugin using deactivate_plugins()
- How To Add Code To WP Without Plugin or Functions
- Enahanced search for edit.php and custom post type
- Different plugins activated online and offline
- Find And Add Category to Posts
- admin panel save option with ajax
- Woocommerce Subscriptions – Customer change subscribed product after placed
- How to Change MU/BuddyPress Group Blog New Installation Defaults [closed]
- Advice on setting up private site
- is ther a plugin that will hide/show content for a scheduled period of time? [closed]
- 404 not found problem with URL rewrite custom category
- Loading post that has visual composer data inside lightbox? [closed]
- Manage Inventory Without Displaying Levels
- How to Allow Users to Select Recipients In a WordPress Comment section?
- Product customizing quiz – quiz adding products to the cart
- How to change all the urls of the WordPress site?