I read that if you create a php file and save it in the /wp-content/mu-plugins/ directory, WordPress will auto-load it.

However, I haven't yet figured it out. I don't have a folder named mu-plugins; it's just wp-content/plugins. I created a file at wp-content/plugins/echo-values.php, put a simple echo value in it and uploaded it, but I don't see the value I echoed in my source code.

I then opened wp-content/plugins/index.php and pasted in the following code:


Again, I don't see anything in my source code, so it looks like those files aren't being included. For good measure, I echoed some text in /wp-content/plugins/index.php, but I don't even see that in the source code.

Can anyone tell me the best way to include my own PHP file? It doesn't have to be in the plugins folder, though I was advised that's the best place to put it.


2 Answers 2


Yes, you can use a /wp-content/mu-plugins folder for

  • single file
  • autoloading

plugins. The only thing you will have to do is to use a plugin header comment in this file:

<?php /* Plugin Name: I am a MU-Plugin */

Then you will find a link on top of your /wp-admin/plugins.php page that says

"Must-Use Plugins"

where you will find the list of mu-plugins. Those plugins can not be deactivated by an administrator or anyone else — only someone having access to your servers filesystem will be able to deactivate them by removing them from this folder.

Note, that plugins residing in subdirectories in this folder will not get loaded.

  • Oh, I see - I have to create the folder mu-plugins myself. I can then insert a file, which will autoload. I'll give it a try, thx.
    – WordBear
    Jun 12, 2016 at 1:58
  • Just a note: The code kaiser gave me works perfectly as is. I created a new file named counties.php, pasted in the code, then put the file in the mu-plugins folder and uploaded it.
    – WordBear
    Jun 12, 2016 at 2:22
  • note it will only autoload files in mu-plugins itself, not it's subfolders. you can use subfolders in mu-plugins but you would have to include those files from a loader file that is in the mu-plugins base directory itself.
    – majick
    Jun 12, 2016 at 6:41
  • @majick I already mentioned that in the answer :)
    – kaiser
    Jun 12, 2016 at 16:46
  • 1
    @kaiser yes i know, just an elaboration for how it can be done if wanted. :-)
    – majick
    Jun 13, 2016 at 3:20

That is not how it works in WordPress. The index.php file is put in plugins directory to prevent unwanted behaviors, it isn't used for including files.

You should checkout plugins development handbook to know the best way to include your files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.