From 6bfc62a22b80244621ab9f7596704d7c0db07595 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 28 Jan 2008 17:21:14 +0000 Subject: [PATCH] Tag searching from jhodgdon. see #5684 git-svn-id: https://develop.svn.wordpress.org/trunk@6670 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/edit-tags.php | 12 +++++++++++- wp-admin/includes/template.php | 10 ++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index 7794ad09c0..14ed23f24d 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -86,6 +86,14 @@ $messages[5] = __('Tag not updated.');

+ +
+ + +
+
+ + @@ -101,7 +109,9 @@ $pagenum = absint( $_GET['pagenum'] ); if( !$tagsperpage || $tagsperpage < 0 ) { $tagsperpage = 20; } -$count = tag_rows( $pagenum, $tagsperpage ); +$searchterms = trim( $_GET['s'] ); + +$count = tag_rows( $pagenum, $tagsperpage, $searchterms ); ?>
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 74df9dc77c..52fde420b2 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -261,11 +261,17 @@ function _tag_row( $tag, $class = '' ) { // Outputs appropriate rows for the Nth page of the Tag Management screen, // assuming M tags displayed at a time on the page // Returns the number of tags displayed -function tag_rows( $page = 0, $pagesize = 20 ) { +function tag_rows( $page = 0, $pagesize = 20, $searchterms = '' ) { // Get a page worth of tags $start = $page * $pagesize; - $tags = get_terms( 'post_tag', "offset=$start&number=$pagesize&hide_empty=0" ); + + $args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0); + + if ( !empty( $searchterms ) ) + $args['name__like'] = $searchterms; + + $tags = get_terms( 'post_tag', $args ); // convert it to table rows $out = '';