So this is how I have my structure setup to attempt to create a mu-plugin for my page.
This statement does not make sense.
Here is what I'm using: - Genesis Framework - Genesis FrameWork Child Theme
mu-plugins have nothing to do with the Genesis framework. The Genesis framework is just a parent theme like any other WP theme. It was just built with the intention that you would build a child theme.
Please let me know if the mu-plugins directory should be there or moved inside the child theme,
You should never move the
also to create just a simple mu plugin that echos 'Hello', where would I begin? Learning as I'm doing this.
To say there's such a thing as an mu plugin is a bit of a stretch, but, this would be the equivalent:
The above code, saved in
wp-content/mu-plugins/hello.php will output the word
hello then exit, and it will do so on every page, every post, every RSS feed, every admin page, etc.
Now I wouldn't recommend doing this, as it means your site will be completely unusable until you delete the file. The
mu-plugins folder is not a place to build your site, add features, or create content.
Basically, I don't think
mu-plugins is what you think it is
This is a folder you can put PHP files in. WordPress will load those PHP files and run them before it runs the plugins and theme.
- They always run, on every request, wether you want them or don't
- They run earlier than plugins and themes
- These aren't plugins, it's just the name of the folder
- Plugin folders won't work, it's just single files ( you'd need to implement that yourself )
- They can't be activated or deactivated, they're not plugins
- The only way to get rid of them is to move them out of the
As the WP Admin screen says, it's just a folder of PHP files that automatically get executed:
They have more in common with dropins.
mu-plugins Useful For?
A number of things, but:
- server level stuff, e.g. I use it to load code that helps with Cron running with Cavalcade
- Network wide hotfixes, e.g. if you visit a subdomain of my site that doesn't exist in my multisite, it'll redirect you
- Network wide rules, e.g. I might want to add things that users cannot disable in their WP Admin interfaces
, such as forcing an option on via a filter
mu-plugins aren't a very good place for functionality though, but they can be useful for low-level compatibility stuff and quick snippets.
What I Think You Actually Want
If you want to use PHP to put things on a page, or implement a page, there are lots of far better ways to do it:
- A normal plugin in the
- Shortcodes! A great way to run PHP inside content, or just embed things
- Page templates, a great way to completely change the code that powers a page
- Theme templates, what you're working with might not be a page, not to worry, there'll be a template file for that, look up the template hierarchy diagram
- OEmbeds, a great way to insert 3rd party content, such as youtube video players, or other things
- Blocks! Take full advantage of the new block editor and build new blocks that add new things to your pages
- The themes
You have lots of options, but the
mu-plugins is probably the very last place you should be thinking of