/ Published in: PHP
                    
                                        
How to get a category id from the name of the category
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
function get_category_id($cat_name){
$term = get_term_by('name', $cat_name, 'category');
return $term->term_id;
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                