WordPress.org

Support

Support » How-To and Troubleshooting » Default value on Category Drop Down

Default value on Category Drop Down

  • AkaMaDdiSk
    Member

    @akamaddisk

    Hi, I’m using this to add a category drop down on my blog. How can I make the default value “Select Category”. Right now the drop down just begins with my first category name once the site loads.

    <?php wp_dropdown_categories(); ?>

    Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • AkaMaDdiSk
    Member

    @akamaddisk

    Anyone have any idea? Thanks much.

    Spencer Finnell
    Member

    @spencerfinnell

    The documentation on wp_dropdown_categories shows that you can add a parameter of show_option_all

    <?php
    	wp_dropdown_categories( array(
    		'show_option_all' => 'Select Category'
    	) );
    ?>

    So you can set that to “Select Category”, which will return a value of 0 if it is left on that option.

    Hi,

    So you can set that to “Select Category”, which will return a value of 0 if it is left on that option

    How to set the value of “Select Category” to a value other than 0?
    I tried setting ‘selected’ value, but still the “Select Category” returns the value 0.

    Please help me with this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Default value on Category Drop Down’ is closed to new replies.