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 would like to introduce page-hierarchy navigation in my WordPress blog using subpages. So each page may have sub-pages, but I'd like that when a visitor clicks on a page header he will be redirected to a specific subpage. For example, say my hierarchy is:

1. Movies
1.1 General
1.2 Westerns
1.3 Animated
2. Music
2.1 General
2.2 Classic
2.3 Country

What I want is that when someone clicks on "Movies" he will reach "Movies/General". Can this be achieved using plugins alone? If not, what's required?

share|improve this question
up vote 4 down vote accepted

Using WordPress custom nav menus create a menu and add the "General" page 2 times. The first as the parent and the second as the first child then add the rest of the pages as childs under the first General.

Change the title in the first general to movies then on the front end when a user clicks movies they will got to the general page.

enter image description here

share|improve this answer
Worked like a charm, thanks! – Roee Adler Apr 29 '11 at 8:35

The following worked like a charm, and better than the answer above. The problem with the answer above is that when viewing sub-sub-pages it was suddenly not possible to highlight the top menu section simply with css. With this solution you can keep the menu as it actually is. (http://www.wprecipes.com/wordpress-page-template-to-redirect-to-first-child-page)

To achieve this recipe, you have to create a page template. Create a new file and paste the following code in it:

Template Name: Redirect To First Child
if (have_posts()) {
  while (have_posts()) {
    $pagekids = get_pages("child_of=".$post->ID."&sort_column=menu_order");
    $firstchild = $pagekids[0];

Save the file under the name redirect.php and upload it to the wp-content/themes/your-theme directory of your WordPress install. Once done, you can use the page template.

share|improve this answer
A redirect without an exit/die after or around it won't work. – kaiser Jan 27 '14 at 11:04

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.