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_singular() in mu-plugins not working
- Cannot install plugins even though www-data has write permissions
- Does wordpress have a post hit counter?
- How to call a plugin function from front end form
- Adding New Role
- Get subcategories with JSON API plugin
- Custom url structure for custom template
- WooCommerce plugin appearance and look [closed]
- adding a text message beside the comment submit button
- How to show category images (from plugin) on a regular page (page-example.php)?
- echo do_shortcode is not working on theme’s template
- use function inside another function in WP Plugin
- Can you limit the memory usage of a particular plugin?
- Scope for PHP Variables Assigned in functions.php or a plugin
- Override the filter from plugin in child theme
- How to remove addthis from my default template
- Average Account Age
- JS Support Ticket – Auto create WP account
- How do I display only the latest post on my home page, while maintaining proper plugin hooks?
- How to remove plug in styles for WPForms Lite [closed]
- Change upload folder for a CPT
- How to allow an editor to edit all WordPress blog posts but have the last say as administrator?
- WP_Async_Task doesn’t appear to be running asynchronously
- Using plugin functions/methods within templates
- How to retain table data in wordpress phpunit tests
- Import sql data from a large file when installing plugin
- Jquery NoConflict Problem
- When taxes are country specific they don’t show in the cart totals
- How to replace website?
- changes to header.php not appearing
- List out all the plugins on WordPress instance
- Can WordPress Drop-ins be given their own directory?
- Can my hooked uninstall class function access a global var declared in main plugin file?
- Flag Comment as inappropriate button plugin
- How can I add IP address to my post?
- serverSideRender does not render “preview” html inside Gutenberg block
- Is there a plugin or a way in the wordpress that would let us have different versions of a post or page accessibe to users?
- How to add/change (woocommerce) product tab icon
- Adding option values as an array using a multi selectable select box
- WordPress plugin database. How to create table for checkbox
- How to set the default value as the saved value once a form of widget is saved?
- Custom post type change excerpt more and excerpt length
- Advanced custom fields and Slideshow gallery desn’t work together? [closed]
- How can I show registration form inside modal?
- Replace video url with video player
- Order posts of a custom post type by the event date using FT Calendar Plugin
- Is it save to replace with in WordPress search form
- Publishing a video from blog to youtube
- Where do I put the code snippets I found here or somewhere else on the web?
- admin_notices show after load completed
- Error in Fetching Custom Post Type parent Category URL (slug)
- WP Fastest Cache -> Render Blocking Js -> Exclude Js Sources
- function post to trash problem
- How to call function in WordPress on button click?
- How to add a “Who’s who” on a wordpress blog post?
- How can I see $post object in frontend from functions.php?
- WordPress site hamburger menu toggle not working
- save short-code in my custom plugin settings problem missed something
- WordPress website working fine on localhost but not displaying front pages on webhost
- Change WordPress plugin widget `id_base` without breaking widget
- Uploading website to live causing problems to plug-in and layout
- How is it possible to create Multi part sections where people can answer or comment or vote on various parts of a page’s content as given example?
- Capture Recaptcha fail event on Contact Form 7
- register_activation_hook not creating table
- Making sure updates didn’t break anything
- how to send two forms with one click (script ninjaforms id)
- wp_schedule_event function reference
- Meta box or shortcode help
- Adding HTML to the search page
- How to retrieve hashtaged tweets from a list of users and post to WordPress
- Using a Cron Job to dynamically populate a field ONCE, and then making the field blank the next time someone visits page
- Custom Function for SEO by Yoast plugin
- Custom feed parameters / Template overriding
- Turning Existing Eccommerce Site into Multi-SIte
- wordpress select multiple options and illegal string offset ‘timeslot’ [closed]
- post_exists() returns a 0 but the 0 doesn’t register [closed]
- Display HTML5 jQuery Audio Player On Front Page
- How Do I Add Product Pictures To Search Results Of A Custom WordPress Theme Using A WooCommerce
- Custom gutenberg block image preview not working
- Update Plugin of wordpress to specific version
- Can WordPress updates take down site functions?
- How to get custom setting from get_option and pass it in getEntityRecords in gutenberg block?
- When to store store plugin options as a single database record?
- How to move a post in Vacancies so it appears in News/Events?
- Can’t install plugins