/ Published in: PHP
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
$my_cat_name = "news";
$my_cat_id = get_term_by('name', $my_cat_name, 'category')->term_id;
echo $my_cat_id; //1
Comments
 Subscribe to comments
                    Subscribe to comments
                
                