Created
May 19, 2015 06:51
-
-
Save iamtekeste/40866c769abf170ebe2c to your computer and use it in GitHub Desktop.
If your term name or titles have ampersands then use _wp_specialchars
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function get_cat_ID( $cat_name ) { | |
| $cat_name = _wp_specialchars( $cat_name ); // get_term_by expects $cat_name to be escaped | |
| $cat = get_term_by( 'name', $cat_name, 'category' ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment