Making WordPress.org


Ignore:
Timestamp:
03/04/2022 04:20:31 AM (3 years ago)
Author:
dd32
Message:

Theme Directory: Filter the theme tags to those the directory knows about.

This prevents the code attempting to add a new term when a theme specifies an 'unknown' tag, causing the tag update to be ignored.

Fixes #6160.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php

    r11588 r11641  
    12621262        // Otherwise create it for this new theme.
    12631263        } else {
     1264
     1265            // Filter the tags to those that exist on the site already.
     1266            $tags = array_intersect(
     1267                $this->theme->get( 'Tags' ),
     1268                get_terms( array(
     1269                    'hide_empty' => false,
     1270                    'taxonomy' => 'post_tag',
     1271                    'fields' => 'slugs'
     1272                ) )
     1273            );
     1274
    12641275            $post_id = wp_insert_post( array(
    12651276                'post_author'    => $this->author->ID,
     
    12731284                'ping_status'    => 'closed',
    12741285                'post_type'      => 'repopackage',
    1275                 'tags_input'     => $this->theme->get( 'Tags' ),
     1286                'tags_input'     => $tags,
    12761287            ) );
    12771288        }
Note: See TracChangeset for help on using the changeset viewer.