How To Add Code To WP Without Plugin or Functions

In your case (I have done this on a number of sites of my own), I would use a “dummy” must-use plugin.

This plugin, which doesn’t really need to say all that much, simply has a require statement to include the php code that I want to include from another location on the server.

MU plugins are active on all sites on the network, and the “edit plugin” interface does not interact with them. MU plugins don’t even need headers, and with no headers present, all that is shown is the filename — which again, you can make to say anything you want.


Another option is to add a custom require line within the wp-config file. This is very early on in the WP process, so you may be limited with what your custom code can do.