New answers tagged


get_template_directory_uri() will always return the URI of the current parent theme. To get the child theme URI instead, you need to use get_stylesheet_directory_uri(). You can find these in the documentation, along with a list of other useful functions for getting various theme directory locations. If you prefer to use a constant, then TEMPLATEPATH is ...


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-...


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.


The right function to use is: plugin_dir_path(); Example: include_once plugin_dir_path( __FILE__ ).'plugin-functions.php';


If you're feeling lazy you could also do require_once( ABSPATH . PLUGINDIR .'/pluginname/pluginfunctions.php' ); This helps if you like to keep your code lines short but isn't much different from pbd's answer.

Top 50 recent answers are included