Skip to main content

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
141 views

Disable Plugin if not logged in

I am trying to disable a chatbot plugin if the user is not logged in. In a MU Plugin I can use this filter - but the trouble is the is_user_logged_in() function does not yet exist, and neither is the ...
StripyTiger's user avatar
0 votes
1 answer
39 views

is_singular() in mu-plugins not working

I wanted to use mu-plugins to load the plugin only on a page with a single blog post. Unfortunately, the is_singular('post') function is not working properly. So I tried using $post->post_type, but ...
patryk siuta's user avatar
2 votes
0 answers
136 views

Can't load text domain in a mu-plugin

My plugin is in: /root/.../mu-plugins/my-plugin In /root/.../mu-plugins/my-plugin/languages/ I have the following files: my-domain.pot my-domain-fr_CA.po my-domain-fr_CA.mo The strings I want to ...
Gazillion's user avatar
  • 317
0 votes
1 answer
78 views

Is there a canonical way for a plugin to install a mu-plugin or drop-in?

I have a couple of plugins that need to install drop-in modules or mu-plugin modules when they're activated, and remove them when they're deactivated. This requires copying -- or maybe symlinking -- a ...
O. Jones's user avatar
  • 481
0 votes
1 answer
354 views

Unable to access WPadmin, website down

I'm not a dev. This is little too much for me. Can anybody just point me in the direction as to what the hell is going on?? Tried to recover a good working point. Tried disabling Plugins. Increased ...
David H's user avatar
1 vote
1 answer
1k 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 ...
MR. shaikh__92's user avatar
1 vote
0 answers
23 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. ...
Luke Seall's user avatar
0 votes
1 answer
274 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 ...
tim's user avatar
  • 164
0 votes
1 answer
756 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=&...
Brave Warrior's user avatar
0 votes
1 answer
949 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 ...
Brave Warrior's user avatar
0 votes
0 answers
54 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, ...
Yvan Gagnon's user avatar
1 vote
1 answer
1k 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-...
now_world's user avatar
  • 115
1 vote
2 answers
1k 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 ...
exxodus7's user avatar
  • 111
0 votes
4 answers
2k 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
104 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
1k 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'; ...
joelanco's user avatar
0 votes
0 answers
386 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
279 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/...
Peter Kirwan's user avatar
0 votes
2 answers
529 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 ...
Travis Pflanz's user avatar
1 vote
1 answer
3k 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 ...
Connor's user avatar
  • 310
6 votes
1 answer
1k 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-...
leymannx's user avatar
  • 3,221
1 vote
0 answers
532 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 ...
Brent's user avatar
  • 793
2 votes
1 answer
294 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 ...
Tom Auger's user avatar
  • 7,086
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=...
khan's 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 ...
Eduardo Leão's user avatar
0 votes
0 answers
121 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']) ); ...
MediaFormat's user avatar
1 vote
2 answers
3k 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 ...
Kevmon's user avatar
  • 111
0 votes
1 answer
278 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 ...
philsalt's 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; } ...
Joe Bobby's user avatar
  • 749
0 votes
1 answer
87 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: <?...
Rich's user avatar
  • 7
0 votes
1 answer
106 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 ...
Why sham Zaheer's user avatar
1 vote
2 answers
516 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 ...
Vico's user avatar
  • 123
0 votes
1 answer
154 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 ...
matthew's user avatar
  • 475
6 votes
1 answer
3k 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 ...
Mac Luc's user avatar
  • 185
0 votes
1 answer
520 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 ...
9ete's user avatar
  • 231
7 votes
1 answer
644 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 ...
Adam's user avatar
  • 349
0 votes
1 answer
44 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 ...
NotoriousWebmaster's user avatar
4 votes
1 answer
166 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, ...
Petr Cibulka's user avatar
4 votes
1 answer
3k 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 ...
Petr Cibulka's user avatar
1 vote
2 answers
1k 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.
user1746018's user avatar
0 votes
1 answer
855 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 ...
mrwweb's user avatar
  • 10.3k
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) ...
Mayur Karwa's user avatar
3 votes
4 answers
5k 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 ...
Travis Pflanz's user avatar
1 vote
1 answer
2k 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 ...
Jonathan Wold's user avatar
1 vote
3 answers
6k 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 ...
emersonthis's user avatar
  • 1,357
9 votes
1 answer
475 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 ...
fuxia's user avatar
  • 107k
2 votes
2 answers
2k 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-...
brasofilo's user avatar
  • 22.1k
2 votes
1 answer
2k 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 ...
jw60660's user avatar
  • 1,526
13 votes
3 answers
15k 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, ...
Anh Tran's user avatar
  • 4,152