WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a settings page. If I print things within index, I can see it. If I try to include it, I can't see anything, neither errors.

add_options_page('My Plugin', 'My Plugin', 'manage_options', 'my-plugin', array('MyPluginSettings', 'index'));

my settings:

class MyPluginSettings
    public function index()
        /* I can echo or print here and it works fine ...
         * But i can't require a file here ... nothing happens


What's wrong? Thanks.

share|improve this question
Are you using absolute or relative path? What is your file really named (this might matter)? – Rarst Jul 26 '11 at 20:15
up vote 1 down vote accepted

Most likely the file cannot be found, I'm assuming the file you're trying to include is located in your theme folder, in that case you should use:

require_once( TEMPLATEPATH . '/file.php');

TEMPLATEPATH will return something like this: /home/user/httdocs/wp-content/themes/twentyeleven.

Worst case scenario you'll find a Fatal Error, but that'll help to find the problem.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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