Created
July 11, 2013 18:39
-
-
Save mikesusz/5977998 to your computer and use it in GitHub Desktop.
quick & dirty hack to put a Tags dropdown on the "All Posts" page in WordPress admin.
This file contains 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
add_action('restrict_manage_posts','my_restrict_manage_posts'); | |
function my_restrict_manage_posts() | |
{ | |
global $typenow, $wp_query; | |
if ($typenow=='post') | |
{ | |
$current_tag = $wp_query->query_vars['tag']; | |
$tags = get_terms('post_tag'); | |
?> | |
<select name="tag"> | |
<option value="">All Tags</option> | |
<?php | |
foreach( $tags as $tag ) | |
{ | |
echo '<option value="' . $tag->slug . '"'; | |
if( $tag->slug == $current_tag ) | |
{ | |
echo ' selected="selected" '; | |
} | |
echo '>' . $tag->name . '</option>'; | |
} | |
?> | |
</select> | |
<?php | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment