I've created a simple site specific functions plugin but I'm having some trouble including additional files to it.

Basically I'm trying to keep things separated so I've got one php file for general functions (The default plugin file) and another for custom post types and taxonomies.

Here's a sample of my current code, does anyone know where I'm going wrong?;

Plugin Name: Functions Plugin
Description: Site specific functions

include( plugin_dir_path( __FILE__ ) . 'types.php');

/* General Functions Here */

  • Try without using plugin_dir_path() function like this include( 'types.php'); Sep 5, 2013 at 14:29
  • Are you sure the file is named exactly types.php and it exists in the same folder of plugin file? How have you tested that the including is not working? Have you tried your plugin with only this code? If you replace include with require what happen?
    – gmazzap
    Sep 5, 2013 at 14:31
  • I tried that to start with, I just got the white screen of death. Sep 5, 2013 at 14:31
  • @G.M. Yes, I've tried all of those things. The file is 100% called types.php and is in the same folder Sep 5, 2013 at 14:32
  • I can't be sure, but seems there is some fatal error in your 'types.php'
    – gmazzap
    Sep 5, 2013 at 14:32

1 Answer 1


try this

include(plugins_url( 'types.php' , __FILE__ ));



Note: don't forgot about path if have that file in a sub folder like inc or js,assets. Mention them

  • 1
    plugins_url works? Are you testing on local environmnet, don't you? I bet this will not work on online server. allow_url_include is often disabled on webservers, and it should be so. @Poisontonomes
    – gmazzap
    Sep 5, 2013 at 14:58

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.