Questions tagged [mu-plugins]

Must Use Plugins are loaded without a manual activation. They are stored in wp-content/mu-plugins and don’t need a regular plugin header.

Filter by
Sorted by
Tagged with
0 votes
1 answer
63 views

why my must use plugins (mu-plugins) not work at localhost?

I have my local WordPress setup I create folder named mu-plugins in wp-content/plugins/mu-plugins and in mu-plugins directory I create one file and write a simple code for test my mu-plugins not work ...
user avatar
0 votes
0 answers
16 views

Install a MU plugin from within another plugin

I am writing a plugin that needs to disable another plugin on specific pages of the site. I know how to do this using the option_active_plugins filter, but that filter only works from an MU plugin. ...
user avatar
0 votes
1 answer
29 views

"Disable" specific plugins on certain pages

I want to disable specific plugins on specific frontpages, but not "disable" them in the backend, i.e. really disable them in the DB. Just NOT load them, as if they weren't installed. Did ...
user avatar
  • 152
0 votes
1 answer
250 views

Noscript not working as it should in wordpress site

This is what I've done in my custom functions mu-plugin: function jsdisabled() { print '<noscript> <div style="margin:auto; display:table; text-align:center"> <div style=&...
user avatar
0 votes
0 answers
152 views

How to properly load text domain of custom mu plugin

I can't manage to load the text domain of my plugins and it's slowly but surely driving me nuts; especially cuz all the error feedback I get is: false. What I've tried so far (adding the following ...
user avatar
  • 359
0 votes
1 answer
195 views

Notice: Uninitialized string offset: 0 in social sharing mu-plugin

I'm getting a Notice: Uninitialized string offset: 0 This is a mu-plugin that is supposed to show social sharing buttons and the only problem is happening with pinterest. Since it's not connected to ...
user avatar
0 votes
0 answers
25 views

Using the get_template_part method within an mu-plugin not possible?

A while back, I had someone here help me craft a custom mu-plugin (aka: "must use" plugin) that was designed to specially handle 404 server responses. Here is that thread for context, ...
user avatar
1 vote
1 answer
327 views

wp_get_environment_type is undefined

I don't understand wordpress, why is this wp_get_environment_type function undefined? Isn't this a "native" wordpress function? How can I make it defined? Here is my code inside of a MU-...
user avatar
  • 115
0 votes
2 answers
464 views

How to include a mu-plugin as a theme dependency?

I'm going through a tutorial which says that creating new post_types is best handled by creating a new mu-plugin (as opposed to adding it to the functions.php). I understand why, but what I don't ...
user avatar
  • 101
0 votes
4 answers
1k views

Enqueue custom css file on specific page

So I've been messing with this for a while now and I don't understand how I'm unable to pull in my style file properly by registering and calling it at all. Here is my method: public static function ...
user avatar
0 votes
1 answer
75 views

Using mu-plugins on the Genesis Framework

So this is how I have my structure setup to attempt to create a mu-plugin for my page. Here is what I'm using: - Genesis Framework - Genesis FrameWork Child Theme Please let me know if the mu-...
user avatar
2 votes
2 answers
806 views

register_activation_hook in mu-plugin not triggering

I have a class setup to run some database scripts on my mu-plugin. function activate_mjmc_core() { require_once plugin_dir_path( __FILE__ ) . 'includes/class-mjmc-core-activator.php'; ...
user avatar
0 votes
0 answers
207 views

register_theme_directory() not working from mu-plugin

I have a must use plugin that uses register_theme_directory() but no matter what path I pass in, it always returns false. For some background I am using domain based database switching in the wp-...
user avatar
-1 votes
2 answers
194 views

Mu-plugin causes entire site to crash [closed]

I think i'm probably doing something daft here. Every time i try to include this as a mu-plugin it takes down the test site though. <?php if( is_plugin_active( '/public_html/wp-content/plugins/...
user avatar
0 votes
2 answers
344 views

Add OR in mu-plugin to check if one of multiple users is the logged in user

I've searched through WordPress Development and couldn't find the answer, so I either didn't search very well or I couldn't figure out the actual term I needed to search for... I am trying to create ...
user avatar
0 votes
1 answer
2k views

How to update mu-plugin

I'm managing a wordpress site that was developed by another party, and they put a bunch of plugins in the mu-plugins folder. These plugins can't be updated via the default interface of WordPress, and ...
user avatar
  • 280
5 votes
1 answer
936 views

How do I activate an mu-plugin with WP-CLI?

Do I need some extra WP-CLI bundle to activate mu-plugins via command line? I can't find anything about that in the docs. Are mu-plugins treated differently by WP-CLI? I created /wp-content/mu-...
user avatar
  • 2,923
1 vote
0 answers
516 views

Is it possible to store Custom Post Type data in separate set of tables and still have wp_post class functionality?

I have a couple of custom post types (course and assignment) for an custom LMS plugin that I'm building. The course CPT represents content that is produced internally by the company. The assignment ...
user avatar
  • 773
2 votes
1 answer
244 views

POEdit with Custom mu-plugins code

I have a very strict directory structure I must adhere to within mu-plugins, but I would like POEdit to be able to help me generate translation files for specific code within this structure, while ...
user avatar
  • 6,786
1 vote
2 answers
5k views

How to send user data in json format to another server when user register on wordpress site in PHP

How to send user data in json format to another server when user register on wordpress site in PHP. I have a server url is like (http://1.2.3.4:49005/SingleMethodName=...
user avatar
  • 117
3 votes
2 answers
1k views

Translation of plugin in MU-PLUGINS directory not working

I have successfully translated a child theme, but not the same result in mu-plugins folder. The name of the plugin is "mu-functions.php". In this file I have added the "Text Domain: mu-functions" in ...
user avatar
0 votes
0 answers
94 views

mu-plugins body_class filter not working

So this code was working fine in mu-plugins until an update back in september or so... function save_cookie_class( $classes ) { array_push( $classes, isset($_COOKIE['some_cookie']) ); ...
user avatar
1 vote
2 answers
2k views

mu-plugins aren't loading

I've looked at other posts regarding mu-plugins but I don't understand yet. Here's the situation: My site is hosted by a service that automatically sets up 2 caching plugins. Cloudflare and OP ...
user avatar
  • 111
0 votes
1 answer
228 views

ignoring, hidding mu plugins when wp-cli is run

wp-cli & a mu plugin don't get along causing the following error: "Fatal error: Call to a member function getAdminOptions() on null in /wp-content/mu-plugins/mobile-smart-proMU.php" Line of ...
user avatar
0 votes
1 answer
33 views

Code Executing Too Late?

I created an mu-plugins folder with this block of code in it: if ( $_SERVER["HTTP_HOST"] === "domain1.com" ) { $sitetype = one; } if ( $_SERVER["HTTP_HOST"] === "domain2.com" ) { $sitetype = two; } ...
user avatar
  • 719
0 votes
1 answer
71 views

mu-plugins is there something special I need to do to make it work?

I created a mu-plugins directory in wp-content As long as it is empty, I have no issue, but the moment I put a file in there, even if the file is like this: filename: somecode.php filecontent: <?...
user avatar
  • 7
0 votes
1 answer
94 views

Must use Plugin not updating HTML code in head

I am trying to insert code in head tag through MU Plugin. I don't know why head tag and init is not updating by using add_action('wp_head', 'my_function') and add_action('init', 'my_function2'). My ...
user avatar
1 vote
2 answers
465 views

Get post/page data outside the loop

I'm trying to make a mu-plugin dedicated to make OpenGraph tags for my website, since the current plugin in WP directory arent updated for ages. But i ran with several headaches trying to get post or ...
user avatar
  • 123
0 votes
1 answer
137 views

What Are the Advantages of Using an mu-plugin

What is the advantage of putting code in a mu-plugin as appose to a plugin or child theme? What is the proper usage for the mu-plugin? I mean I can just put code in my child theme but is that the ...
user avatar
  • 475
6 votes
1 answer
2k views

Customize default settings on new sites on multisite

As the title states i need an approach to change default settings when a new site is created on my wordpress multi site. I guess its easiest to keep the code in a mu-plugin but can a go about having ...
user avatar
  • 185
0 votes
1 answer
418 views

Certain functions are undefined when called form mu-plugins

I have a correctly formatted php functions file in my mu-plugins/ directory. When trying to use wp_is_mobile() or current_user_can(), I get an undefined function error. Fatal error: Call to undefined ...
user avatar
  • 231
7 votes
1 answer
533 views

Auto Load Plugin Hooks inside Must Use Plugin

I am creating a custom MU plugin to run on a multi-site network. I am working on a function that will dynamically include files containing additional action and filter hooks based on the active ...
user avatar
  • 349
0 votes
1 answer
39 views

Are mu-plugins plugins still deployed via wordpress.org/plugins?

I'm getting ready to publish my first plugin. I've decided to put it in mu-plugin, because if you removed it, it would break other code dependent on it. (It's a developer tool for logging variables to ...
user avatar
4 votes
1 answer
161 views

Namespacing WordPress project according to FIG standards

I am trying to wrap my head around the namespaces, autoloaders and FIG standards and most importantly how to achieve their integration to WordPress as close as possible. Here is my file structure, ...
user avatar
4 votes
1 answer
2k views

Must-use plugins autoloader: How to use get_plugins() correctly?

My autoloader class is responsible for loading must-use plugins that do not sit in the root of the mu-plugins folder. To locate them, I need to use the get_plugins() function. According to Codex, the ...
user avatar
1 vote
2 answers
956 views

Hide mu-plugins list

I'm using mu-plugins, http://codex.wordpress.org/Must_Use_Plugins. These plugins are showing in plugins.php, http://d.pr/i/JIvX. Is there any way to hide it? Thanks.
user avatar
0 votes
1 answer
758 views

Define constant for one plugin in mu-plugin

I'm trying to define the constant ACF_Lite as true so that the interface of the Advanced Custom Fields plugin is hidden on all of my multisite subsites except the parent. For clarity and ...
user avatar
  • 9,947
0 votes
3 answers
1k views

How can woocommerce be used in mu-plugins folder?

I don't want clients to deactivate woocommerce plugin even by mistake. And I have recently come across a concept called must use plugins in wordpress. (http://codex.wordpress.org/Must_Use_Plugins) ...
user avatar
3 votes
4 answers
4k views

Can the wp-plugins (Must Use Plugins) URL be targeted for use in functions.php?

Can the wp-plugins (Must Use Plugins) URL be targeted for use in functions.php? I have a mu-functions.php file in the mu-plugins folder. One function calls a javascript file (alerts.js) located in ...
user avatar
1 vote
1 answer
1k views

Using WP_Query within an mu-plugin

I'm trying to create a list of parent IDs for a custom post type for use within a "must use" plugin I'm developing on a project. Here's the code I'm using to generate the query: $cpt_parents = new ...
user avatar
1 vote
3 answers
5k views

No first_name or user_firstname property in WP_User object

I'm writing a basic plugin. Here's my code: $new_user = get_userdata($user_id); $first_name1 = $new_user->user_firstname; $last_name1 = $new_user->user_lastname; echo "<" . $first_name1 ...
user avatar
  • 1,247
9 votes
1 answer
415 views

How to prevent redirect to 'About' after core upgrade?

In wp-admin/includes/update-core.php we find the following line: add_action( '_core_updated_successfully', '_redirect_to_about_wordpress' ); I want to remove this action, so I created a mu plugin ...
user avatar
  • 105k
2 votes
2 answers
1k views

How to use a Must-Use plugin to hide a regular one and to hide itself?

When solving this issue ( Change admin language based on user (in single-site) ), I did a function so that the plugin would auto-hide from all users except one (me:). The flaw is that it only auto-...
user avatar
  • 21.7k
2 votes
1 answer
1k views

How the mu-plugins Folder Works in a Multisite Installation?

I'm a little confused about when I should be placing plugin files into mu-plugins. I know it's Must-Use plugins and I know that they are automatically enabled. In the network setting, though, does ...
user avatar
  • 1,476
13 votes
3 answers
12k views

Plugins in mu-plugins folder are not loaded

I'm trying to load plugins automatically by putting the plugins into mu-plugins folder. But if the plugin is put in a folder, it isn't loaded. I tried some popular plugins such as W3 Total Cache, ...
user avatar
  • 3,976