I've made some plugins to print some text with php from the database. I use them in pages via shortcodes. If I put all the code in only one folder, so just one plugin, only one shortcode works,the one in the file with the same name of the plugin. How can I put all files in only one folder and have all shortcodes working?

1 Answer 1


Choose one file to be the main file of the plugin. From it, use

require_once( plugin_dir_path( __FILE__ ) . 'another-file.php' );

for each of the other files you want to include.

This means the rest of the files no longer need the plugin comment header, just the actual code that does whatever you need it to.

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.