The function get_all_category_ids()
from WordPress it is deprecated so I need to replace with get_terms()
but I can't make it work. Can you please help me to make this code to be valid on WordPress 4.0 ?
<label>Choose category</label>
<select name="mycategories" >';
$category_ids = get_all_category_ids();
foreach($category_ids as $cat_id)
{
$cat_name = get_cat_name($cat_id);
if($category == $cat_id)
{
$html .= '<option selected="selected" value="'.$cat_id.'" '.$cat_name.'>'.$cat_name.'</option>';
} else {
$html .= '<option value="'.$cat_id.'" '.$cat_name.'>'.$cat_name.'</option>';
}
}
$html.= '</select>