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?


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


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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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