WordPress Development Asked by anandmongol on August 10, 2020
I’m wondering how to sort a custom post’s categories in the selection field which I’ve circled in the screenshot?
And I have the following code which generates category listing
$args=array(
'class' => 'select-submit2',
'hide_empty' => false,
'selected' => $prop_category_selected,
'name' => 'prop_category',
'id' => 'prop_category_submit',
'orderby' => 'NAME',
'order' => 'ASC',
'show_option_none' => __('None','wpestate'),
'taxonomy' => 'property_category',
'hierarchical'=> true
);
wp_dropdown_categories( $args ); ?>
You need to change the orderby
to ID
:
$args=array(
'class' => 'select-submit2',
'hide_empty' => false,
'selected' => $prop_category_selected,
'name' => 'prop_category',
'id' => 'prop_category_submit',
'orderby' => 'ID', //this changed to ID
'order' => 'ASC',
'show_option_none' => __('None','wpestate'),
'taxonomy' => 'property_category',
'hierarchical'=> true
);
wp_dropdown_categories( $args ); ?>
Answered by David Lee on August 10, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP