Making WordPress.org


Ignore:
Timestamp:
02/22/2024 06:44:16 AM (2 years ago)
Author:
dd32
Message:

Plugin Directory: Readme: Add a note for when the tags specified have low usage.

See #6108.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-parser.php

    r13236 r13237  
    307307                $this->warnings['ignored_tags'] = true;
    308308            }
     309
     310            // Check if the tags are low-quality (ie. little used)
     311            if ( $this->tags && taxonomy_exists( 'plugin_tags' ) ) {
     312                $tags = get_terms( array(
     313                    'taxonomy' => 'plugin_tags',
     314                    'name'     => $this->tags,
     315                ) );
     316
     317                $low_usage_tags = array_filter(
     318                    $tags,
     319                    function( $term ) {
     320                        return $term->count < 5;
     321                    }
     322                );
     323
     324                $this->warnings['low_usage_tags'] = wp_list_pluck( $low_usage_tags, 'name' );
     325            }
     326
    309327            if ( count( $this->tags ) > 5 ) {
    310328                $this->tags = array_slice( $this->tags, 0, 5 );
Note: See TracChangeset for help on using the changeset viewer.