How to properly load text domain of custom mu plugin
How to properly load text domain of custom mu plugin
How to properly load text domain of custom mu plugin
Apparently, there’s no way to remove one plugin from the Must-Use list… But then, found a filter that does even better: show_advanced_plugins will completely hide the sight of the Must-Use plugins. After all, if you’re trying to hide something of this nature, then hide it all… It’s inside the class WP_Plugins_List_Table and takes two arguments: … Read more
EDIT: this solution is not a best-practice. Please use the solution submitted by Nathan below! Use the WPMU_PLUGIN_DIR and WPMU_PLUGIN_URL constants 🙂 function load_my_alerts(){ wp_register_script( ‘my_alerts’, WPMU_PLUGIN_URL . ‘/js/alerts.js’, array( ‘jquery’ ) ); wp_enqueue_script( ‘my_alerts’ ); } add_action(‘admin_enqueue_scripts’, ‘load_my_alerts’);
You are overthinking this. The namespace structure applies at the level of individual package. There is no need or push to treat the whole site as such package. Also one of the benefits of using autoload in first place is that it makes location of classes in file system largely irrelevant. So the simple and … Read more
‘get_plugins’ is intended to be used only with regular plugins, and also it looks at plugin headers, and return only plugins that have valid one, like /* Plugin Name: A plugin */ However mu-plugins can work even without that headers. Also consider that with WP 3.9 was introduced the function wp_register_plugin_realpath that should be used … Read more
WordPress provides a filter called wpmu_new_blog and passes the parameter $blog_id (the ID of the new blog) and $user_id (the user, that just created that new blog) (and some more) to it. You can hook into this action to create the new pages and edit the options: <?php /** * Plugin Name: Default Site Structure … Read more
mu-plugins don’t get activated. They’re activated just by being in that folder.
With Multisite, you need to use add_site_option/get_site_option instead of add_option/get_option. https://codex.wordpress.org/Function_Reference/get_site_option
Don’t remove the action but add your own before it. If you remove the action you will never get the message saying it was upgraded successfully. Here you can provide your own info on what to do next. function tp_dont_redirect_to_about_wordpress( $new_version ) { global $wp_version, $pagenow, $action; if ( version_compare( $wp_version, ‘3.4-RC1’, ‘>=’ ) ) … Read more
Does WordPress only loads plugins which are just single files in mu-plugins? No, they do not need to be single files but you cannot use plugins in their own subfolders as in the standard plugins/ folder. The main plugin file (one with the specified plugin header info) has to be right there in mu-plugins/. Other … Read more