Making WordPress.org

Changeset 14003


Ignore:
Timestamp:
08/28/2024 03:49:05 AM (17 months ago)
Author:
dd32
Message:

Plugin Directory: Don't adjust queries for non-plugin-content.

When the Plugin Directory code was written, the only front-end queries were for plugins/posts/pages, in modern WordPress however we're also querying for block templates and other post types.
The existing code was applying customisations to those queries, such as requiring the template be modified within the last 2 years or to be attached to a specific taxonomy. That's not expected or ideal.

This resolves it by bailing early if non-plugin-content is being queried.

File:
1 edited

Legend:

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

    r14002 r14003  
    789789                $wp_query->query_vars['post_type'][] = 'page';
    790790            }
     791        }
     792
     793        // If it's a query explicitely for non-plugin-related content, bail.
     794        if (
     795            ! empty( $wp_query->query_vars['post_type'] ) &&
     796            'plugin' !== $wp_query->query_vars['post_type'] &&
     797            ! in_array( 'plugin', (array) $wp_query->query_vars['post_type'], true )
     798        ) {
     799            return;
    791800        }
    792801
Note: See TracChangeset for help on using the changeset viewer.