My plugin needs to add a few screens to the frontend of the site, eg. a history overview (http://www.site.com/history?event=X).

At first, I implemented this by programmatically adding a page with a shortcode in the body, putting the logic behind the shortcode. This works well because the user can now edit the page title, URL and page template to influence how this page looks on his front end.

However, an unwanted side effect is that, at least in the default Wordpress theme (I haven't checked in others for now), my page shows up in the navigation bar on the frontend. I don't want this, both for aesthetic reasons and because the page needs a parameter to run (?event=X) and doesn't stand on its own.

So my second idea was to create a custom post type. That way I can tell it not to show up in the navigation menu (show_in_nav_menus => false), but now I lost the user's ability to apply a page template to it.

So my actual question is "Can I programmatically create a page that won't show up in the navigation bar?", but if I'm doing something stupid and there's a much better way to handle this, I'll be happy to hear about it.

1 Answer 1


Auto show a page in a navigation bar is not a standard feature of Wordpress. It is a specific feature of theme or plugins. If the theme you are using has this feature and you don't want it you will need to create a child theme and modify this behaviour.

Anyway, what you have described is really better done with a custom post type. Think about it. You are using a page (a post type) to embed another type of content. Wordpress allows you to define custom types of content, called custom post type. Use it, it is much much much better: custom templates, managament UI, searh, queries API, meta data API, object chache, permlinks, easy import and export, and so on.

  • It might not be a standard feature, but it's being done in the standard theme, so that counts for something. That being said, I do agree that a CPT is probably the way to go here. I only wish I could apply a page template to it.
    – efdee
    Sep 12, 2014 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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