MU-Plugins load very early– earlier that your theme or your normal plugins. Because of that, you sometimes need to hook functions that you would otherwise not have to hook.
add_action(
'plugins_loaded',
function () {
if (( is_multisite() && !current_user_can('manage_network') ) || ( !is_multisite() && !current_user_can('create_users'))) {
add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
}
}
);
The plugins_loaded
hook basically means the function will execute just after the normal plugins load, and that seems to be late enough and reasonable to boot.
Related Posts:
- Update Option Stored in Multi-Dimensional Array
- check if Gutenberg is currently in use
- WordPress Plugin Development – Headers Already Sent Message
- Get page content using slug
- Best practices for using the transients API
- $wpdb->insert_id
- Remove profile picture option (and other things) from profile.php (in admin)
- How to disable plugin update notification for a specific plugin in Multisite
- Elementor Fatal error: Class ‘Elementor\Widget_Base’ not found
- How Can I Add a Filter to Class Instance Only?
- Getting old term value with edited_{$taxonomy} | Hook
- Headers already sent error with CSV export plugin
- How to add HTML / Form to an Admin Bar Menu
- Call activation hook multiple times
- Adding custom code into header.php using a plugin
- Building a better media uploader for WordPress
- Two-step login process – Is it possible?
- Calling clean_term_cache() fails when called in the same plugin that creates terms, succeeds when called separately?
- Dropdown list of pages to get page id to store in plugin options
- How to add custom content under plugin row in WordPress admin plugin list?
- What is the best way to overwrite /wp-admin/ms-delete-site.php
- Create a new page in a plugin
- Where should I store global data for my multi-site WordPress plugin?
- Header Button Chance Polylang Elementor
- Can I use namespaces in my plugin?
- Find source of notice / warning / errors efficiently
- Will cron job run if page loaded is being served from cache?
- Sharing common functionality (functions, template parts) between plugins and themes?
- Access first name and last name from user_register
- Use wp_set_post_terms() instead of wp_insert_post()
- Woocommerce custom emails without header and footer
- Adding set of custom fields to WordPress Post in Dashboard
- Check and load class of theme from a plugin
- TinyMCE 4.7.11 custom styles using styleselect – what does the ‘attributes’ argument do?
- Modifying meta tags after doing ajax call in plugin
- Modifying the default WordPress .htaccess with a plugin
- What is the proper way to include Bootstrap when executing a shortcode
- Create a free scripts and styles template within a plugin
- Is there a way to list all actions registered by a plugin or theme?
- WordPress Plugin with a shortcode that dynamically generates javascript. Can I use add_action without wrapping the javascript in a function?
- Call wp_generate_password() from within a Class
- How can I turn a custom wordpress page into a product page?
- Elementor custom Query with ACF fields to show matching woocommerce products custom fields
- How to enqueue style in WordPress plugin from theme files?
- Set different custom menu items for different user roles
- Bootstrap version conflict 3 with 4 for wordpress theme and plugin [closed]
- pre_get_post alter current post id
- 3rd Party Plugin dependency – how to correctly load classes
- Auto-Populate Image After Media Upload
- Problems with cron
- How dynamic action login_form_{action} is working
- WP Multisite login not working on one subsite. Possibly cookies/ history issue?
- dbDelta not installing database
- How do I add a favicon that only shows during viewing of my plugin’s admin panel?
- Can’t get CSS Into the Head via add_action
- Cannot get jQuery UI to enqueue in my plugin!
- Remove Default Blogroll Links via Plugin script
- Catching Form Submission in WordPress Admin Panel
- Filter posts in pre_get_posts order by meta value date (desc or asc)
- How to display the category id along with category name on categories list?
- How to replace settings in WordPress plugin from a theme
- Save temporary registration data
- Activate / Deactivate plugin
- How to validate inputs with filter in register_setting callback
- Serial Number from custom table not appear in woocommerce_email_before_order_table action
- Is it possible to use the MySQL’s ORDER BY FIELD() clause as part of the pre_get_posts hook?
- How to replace the existing metatag using the backend to insure a thumbnail image gets fetched when we share on social media?
- When setting styles to an extended block that was saved as a pattern, it doesn’t remove the style that was there
- Sanitization and validation input fields – Settings API
- How to limit number of category term display in home page grids?
- A question on init and activation hooks
- Always hide a page from the menu
- Add custom html classes to gutenberg wrapper
- Author Meta in Author URL Link
- Warning: Illegal string offset ‘Andorra’ in … on line 106
- Update database record in plugin
- Different style for specific rows in custom list table using WP_List_Table
- get_comment_meta() for a filter hook in a plugin
- form does not generate $_POST request
- Callback function quicktags that uses variable in start tag
- Font Awesome stopped showing icons, shows &# text instead [closed]
- WordPress Plugin Tool Tip Helpers
- How can I add the Post ID to Class Name in Jquery?
- How to show metabox just in post.php in admin?
- Can I use a hook other than ‘init’ to handle form submissions?
- Managing Custom Designed Content
- Stop theme displaying comments
- Do a summary based on sections in a post
- Plugin as custom page
- Can’t switch theme after activation
- Plugin capabilities
- plugin will not offer update even though a new version is available
- How do I replace title with my plugin?
- Deactivate plugin on registration
- How to filter manage categories listing
- Enqueue Script in custom plugin before other
- How to remove a class [closed]
- What’s wrong in the WordPress Meta Box Generator code?
- add category id to option name when adding an option on edit_category
- esc_url, esc_url_raw or sanitize_url?