Skip to content

Instantly share code, notes, and snippets.

@mfields
Created March 27, 2011 00:53
Show Gist options
  • Save mfields/888796 to your computer and use it in GitHub Desktop.
Save mfields/888796 to your computer and use it in GitHub Desktop.
/**
* Get a random tag.
* @since 2011-03-26
*/
function mfields_get_random_tag() {
var_dump( get_terms( 'post_tag', array(
'number' => 1,
'orderby' => 'RAND()',
) ) );
}
add_action( 'wp_head', 'mfields_get_random_tag' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment