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 using Sidebar Generator in all my themes.

The plugin works perfectly normal from "plugins" directory, but I want to embed it somehow to my themes, so it won't display on Installed Plugins list.

I've just copied sidebar_generator.php (the whole code is luckily in one file) to mytheme/plugins and included it in functions.php

require_once (MY_PLUGINS . '/sidebar_generator.php');  

Now, it worked for all other plugins, but not for this one! This way when I click on "Sidebars" it refreshes the actual page instead of loading plugin's admin_page.

Any ideas why is it happening and how to make it working?

I believe the problem lays here:

add_submenu_page('themes.php', 'Sidebars', 'Sidebars', 'manage_options', __FILE__, array('sidebar_generator','admin_page'));

Chaning FILE to something else helps, but I'm not sure how to point this submenu link at the actual plugins admin page.

share|improve this question
up vote 0 down vote accepted

It should work (and does when I test on a new WP install) with __FILE__, though it's not recommended because it exposes the server path and is just generally an ugly URL. You can replace it with a unique identifier like 'sb-generator-options' or whatever really, as long as it's unique. the important part is the last param that tells it what function to use to render the page.

Are you maybe moving add_submenu_page out of the plugin file, or are you just editing it in place?

share|improve this answer

Example :



__LINE__ The current line number of the file.

__FILE__ The full path and filename of the file.

__DIR__ The directory of the file.

share|improve this answer
Please add an explanation to your answer: why could that solve the problem? – toscho Aug 5 '13 at 8:05

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.