WordPress.org

Ready to get started?Download WordPress

Forums

Default value on Category Drop Down (4 posts)

  1. AkaMaDdiSk
    Member
    Posted 3 years ago #

    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.

  2. AkaMaDdiSk
    Member
    Posted 3 years ago #

    Anyone have any idea? Thanks much.

  3. Spencer Finnell
    Member
    Posted 3 years ago #

    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.

  4. gautami
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic