Changeset 3207254 – WordPress Plugin Repository (original) (raw)

empty-tags-remover/trunk/empty-tags-remover.php

r3207250 r3207254
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.1.0
6 Version: 1.2.0
7 7 Author: Dan - Lucian Stefancu
8 8 Author URI: https://ospitalier.ro/
9 License: GPLv2 or later
9 10 */
10 11
25 26 if(empty($_POST['remove_my_empty_tags'])) {
26 27
27 $args = array('offset' => 0, 'number' => 0, 'hide_empty' => 0);
28
29 tags=getterms(′posttag′,tags = get_terms( 'post_tag', tags=getterms(posttag,args );
28 tags=tags = tags=tags = get_terms( array(
29 'taxonomy' => 'post_tag',
30 'hide_empty' => false,
31 ) );
30 32
31 33 counttags=count(count_tags = count(counttags=count(tags);
35 37 foreach ($tags as $tag) {
36 38 if ($tag->count == 0) {
37 echo "
  • " . $tag->name . "
  • \n"
    ;
    39 echo esc_html("
  • " . $tag->name . "
  • \n");
    38 40 }
    39 41 }
    51 53 }
    52 54 } else {
    53 $args = array('offset' => 0, 'number' => 0, 'hide_empty' => 0);
    54 55
    55 tags=getterms(′posttag′,tags = get_terms( 'post_tag', tags=getterms(posttag,args );
    56 $tags = get_terms( array(
    57 'taxonomy' => 'post_tag',
    58 'hide_empty' => false,
    59 ) );
    56 60 $count_tags = 0;
    57 61 echo '
      ';
    59 63 if ($tag->count == 0) {
    60 64 wp_delete_term($tag->term_id,'post_tag');
    61 echo "
  • " . $tag->name . " deleted
  • ";
    65 echo "
  • " . esc_html($tag->name) . " deleted
  • ";
    62 66 $count_tags++;
    63 67 }
    64 68 }
    65 69 echo '';
    66 echo '' . $count_tags . " empty tags deleted";
    70 echo sprintf("%s empty tags deleted", esc_html($count_tags)) ;
    67 71 }
    68 72 ?>

    empty-tags-remover/trunk/readme.txt

    r3207250 r3207254
    4 4 Requires at least: 2.5
    5 5 Tested up to: 6.7.1
    6 Stable tag: 1.1.0
    6 Stable tag: 1.2.0
    7 License: GPLv2 or later
    7 8
    8 9 Removes the empty tags, tags with no posts attached.