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 want to get a specific wordpress nav menu as a list in my custom php page outside of wordpress.

How to do that?

share|improve this question
up vote 1 down vote accepted

There are a few ways, here's one:

// no theme output
define('WP_USE_THEMES', false);

// initializes the entire Wordpress
require '/path/to/your/wp/wp-blog-header.php';

// here you print your menu

Even if theme output is disabled, the theme's functions.php should still be loaded (and menu locations registered).

You should cache the HTML somewhere within your script, because loading WP just to show a menu can be slow.

see http://codex.wordpress.org/Function_Reference/wp_nav_menu

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.