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/theme-directory.php

    r11588 r11641  
    521521        }
    522522
     523        // Filter the tags to those that exist on the site already.
     524        $tags = array_intersect(
     525            $theme_data['Tags'],
     526            get_terms( array(
     527                'hide_empty' => false,
     528                'taxonomy' => 'post_tag',
     529                'fields' => 'slugs'
     530            ) )
     531        );
     532
    523533        wp_update_post( array(
    524534            'ID'           => $post_id,
     
    526536            'post_content' => $theme_data['Description'],
    527537            'post_parent'  => $theme_parent_post_id,
    528             'tags_input'   => $theme_data['Tags'],
     538            'tags_input'   => $tags,
    529539        ) );
    530540
Note: See TracChangeset for help on using the changeset viewer.