mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Posts, Post Types: Return early from WP_Posts_List_Table::formats_dropdown()
if the post type does not support post formats.
This avoids an unnecessary database query for the `post_format` taxonomy. Props Chouby. Fixes #50496. Built from https://develop.svn.wordpress.org/trunk@48203 git-svn-id: http://core.svn.wordpress.org/trunk@47972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
42f06389c0
commit
3a6eeef571
@ -485,6 +485,11 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
return;
|
||||
}
|
||||
|
||||
// Return if the post type doesn't have post formats or if we're in the Trash.
|
||||
if ( ! is_object_in_taxonomy( $post_type, 'post_format' ) || $this->is_trash ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the dropdown shows only formats with a post count greater than 0.
|
||||
$used_post_formats = get_terms(
|
||||
array(
|
||||
@ -493,11 +498,8 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* Return if the post type doesn't have post formats, or there are no posts using formats,
|
||||
* or if we're in the Trash.
|
||||
*/
|
||||
if ( ! is_object_in_taxonomy( $post_type, 'post_format' ) || ! $used_post_formats || $this->is_trash ) {
|
||||
// Return if there are no posts using formats.
|
||||
if ( ! $used_post_formats ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-48202';
|
||||
$wp_version = '5.5-alpha-48203';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user