Changeset 3207820
- Timestamp:
- 12/13/2024 11:50:20 PM (16 months ago)
- Location:
- empty-tags-remover
- Files:
-
- 3 added
- 2 edited
-
tags/1.2.3 (added)
-
tags/1.2.3/empty-tags-remover.php (added)
-
tags/1.2.3/readme.txt (added)
-
trunk/empty-tags-remover.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
empty-tags-remover/trunk/empty-tags-remover.php
r3207259 r3207820 4 4 Plugin URI: https://wordpress.org/plugins/empty-tags-remover/ 5 5 Description: Removes the empty tags, tags with no posts attached. 6 Version: 1.2. 26 Version: 1.2.3 7 7 Author: Ospitalier Timisoara 8 8 Author URI: https://ospitalier.ro/ … … 37 37 foreach ($tags as $tag) { 38 38 if ($tag->count == 0) { 39 echo esc_html("<li><a href='edit-tags.php?action=edit&taxonomy=post_tag&tag_ID=$tag->term_id'>" . $tag->name . "</a></li>\n");39 echo "<li><a href='edit-tags.php?action=edit&taxonomy=post_tag&tag_ID=" . esc_url($tag->term_id) . "'>" . esc_html($tag->name) . "</a></li>\n"; 40 40 } 41 41 } … … 47 47 if ($count_tags) { 48 48 ?> 49 <form method="post" action=""> 50 <label for="remove_my_empty_tags">Do you want to remove now all the empty tags?</label> <input type="submit" name="remove_my_empty_tags" value="Yes" /> 49 <form method="post"> 50 <label for="remove_my_empty_tags">Do you want to remove now all the empty tags?</label> 51 <input type="submit" name="remove_my_empty_tags" value="Yes" /> 52 <?php wp_nonce_field( 'remove_my_empty_tags' ); ?> 51 53 </form> 52 54 <?php 53 55 } 54 56 } else { 57 $count_tags = 0; 55 58 56 $tags = get_terms( array( 57 'taxonomy' => 'post_tag', 58 'hide_empty' => false, 59 ) ); 60 $count_tags = 0; 61 echo '<ul>'; 62 foreach ($tags as $tag) { 63 if ($tag->count == 0) { 64 wp_delete_term($tag->term_id,'post_tag'); 65 echo "<li>" . esc_html($tag->name) . " deleted</li>"; 66 $count_tags++; 59 if (check_admin_referer( 'remove_my_empty_tags')) { 60 $tags = get_terms( array( 61 'taxonomy' => 'post_tag', 62 'hide_empty' => false, 63 ) ); 64 echo '<ul>'; 65 foreach ($tags as $tag) { 66 if ($tag->count == 0) { 67 wp_delete_term($tag->term_id,'post_tag'); 68 echo "<li>" . esc_html($tag->name) . " deleted</li>"; 69 $count_tags++; 70 } 67 71 } 72 echo '</ul>'; 68 73 } 69 echo '</ul>'; 74 70 75 echo sprintf("<strong>%s empty tags deleted</strong>", esc_html($count_tags)) ; 71 76 } -
empty-tags-remover/trunk/readme.txt
r3207259 r3207820 4 4 Requires at least: 2.5 5 5 Tested up to: 6.7.1 6 Stable tag: 1.2. 26 Stable tag: 1.2.3 7 7 License: GPLv2 or later 8 8
Note: See TracChangeset
for help on using the changeset viewer.