WordPress.org

Making WordPress.org

Changeset 9935


Ignore:
Timestamp:
05/28/2020 03:30:42 AM (7 weeks ago)
Author:
dd32
Message:

Theme Directory: Don't unset the global $post variable which causes a lot of "weird" failures of functions on a cold cache.

This should resolve the long-standing "what is going on here" questions on the Theme Directory when it comes to the SEO oddities.

See r9949-dotorg (5 years ago).
See #4994.

File:
1 edited

Legend:

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

    r9876 r9935  
    757757        }
    758758
    759         if ( $this->fields['template'] || $this->fields['parent'] ) {
    760             /*
    761              * On requests for single themes the post global can be set, returning that theme as the parent
    762              * if the current theme is not a child theme.
    763              */
    764             unset( $GLOBALS['post'] );
    765 
     759        if ( $theme->post_parent && ( $this->fields['template'] || $this->fields['parent'] ) ) {
    766760            $parent = get_post( $theme->post_parent );
    767761
    768             if ( is_a( $parent, 'WP_Post' ) ) {
     762            if ( $parent ) {
    769763                if ( $this->fields['template'] ) {
    770764                    $phil->template = $parent->post_name;
Note: See TracChangeset for help on using the changeset viewer.