我已经搜索并找到了this 和afew more. 但我仍然无法获取所选名称(不是value,因为value只是一个数字)。get\\u categories keeps返回空数组。
下面是我正在修改的插件的代码。
$categories = apply_filters( \'acadp_admin_listing_form_categories_dropdown\', \'\', $post->ID );
if ( empty( $categories ) ) {
$selected_category = count( $category ) ? $category[0] : -1;
$args = array(
\'show_option_none\' => \'-- \' . esc_html__( \'Select category\', \'advanced-classifieds-and-directory-pro\' ) . \' --\',
\'taxonomy\' => \'acadp_categories\',
\'name\' => \'acadp_category\',
\'orderby\' => \'name\',
\'selected\' => (int) $selected_category,
\'hierarchical\' => true,
\'depth\' => 10,
\'show_count\' => false,
\'hide_empty\' => false,
\'echo\' => false,
);
if ( $disable_parent_categories ) {
$args[\'walker\'] = new ACADP_Walker_CategoryDropdown;
}
$categories = wp_dropdown_categories( $args );
}
echo $categories;