Skip to content

Instantly share code, notes, and snippets.

@NeilJS
Created June 12, 2012 10:35
Show Gist options
  • Save NeilJS/2916810 to your computer and use it in GitHub Desktop.
Save NeilJS/2916810 to your computer and use it in GitHub Desktop.
Get tag id by name
<?php
function get_tag_id_by_name($tag_name) {
global $wpdb;
$tag_ID = $wpdb->get_var("SELECT * FROM ".$wpdb->terms." WHERE `name` = '".$tag_name."'");
return $tag_ID;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment