I have a dropdown menu of pages, but after I go to a page selected, let's say "About us", the default title button of dropbown is the title of the page, "About us", so i want the title/default option to be "Please select a page" or something like that.

My code is this:


What i'm doing wrong or how my code should look?

1 Answer 1


I would suggest, that you switch from "URl query argument" style to arrays. This is a "feature" that is more a left over on some functions that is only available for backwards compatibility reasons than anything else.

Here's a reworked version of your current arguments:

wp_dropdown_pages( array(
    'title_li'    => '',
    'depth'       => TRUE,               // originally: 1,
    'sort_column' => 'menu_order',
    'child_of'    => $post->post_parent,
    'echo'        => FALSE,              // originally: 0,
    'selected'    => $currPage,
) );

Now I wonder how you managed to display that dropdown/select element when echo was set to 0/false and no echo/print was prepended to that statement. If you are just adding it to your template like this, you better set echo to TRUE.

From looking at the selected argument (and as you can read in the docs in Codex), this is the argument that chooses what element currently is selected. As you are setting it to $currPage, which I assume that it contains the current page slug, it shows you exactly that. To "fix" your problem, simply set it to an empty string ''.

About the first/non-selected value: You can set that with the show_option_none argument

'show_option_none' => 'Please select a page',

Your Answer

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

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