Commit 8768e94329 for wordpress.org
commit 8768e943294da0262417fc00a2bd3c8d57553821
Author: westonruter <westonruter@git.wordpress.org>
Date: Wed Oct 14 04:41:51 2026 +0000
Code Quality: Remove unused `$class` in posts list table.
The variable was used to keep the "All" view link from being marked current when the "Mine" link was, but since r54215 each view link in `WP_Posts_List_Table::get_views()` sets its `current` flag from its own condition, and `$class` is no longer used to build any link. The only remaining read, `empty( $class )` in the "All" link's `current` flag, always passed, as the "Mine" block resets `$class` to an empty string after setting it. The variable and every assignment to it are removed, with no change in behavior.
This resolves one error in the `empty.variable` PHPStan baseline.
Developed in https://github.com/WordPress/wordpress-develop/pull/14229.
Follow-up to r31959, r54215.
Props soean, westonruter.
See #65817.
Built from https://develop.svn.wordpress.org/trunk@64339
git-svn-id: http://core.svn.wordpress.org/trunk@63489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php
index 00edeed1ac..d461aacd31 100644
--- a/wp-admin/includes/class-wp-posts-list-table.php
+++ b/wp-admin/includes/class-wp-posts-list-table.php
@@ -298,7 +298,6 @@ class WP_Posts_List_Table extends WP_List_Table {
$status_links = array();
$num_posts = wp_count_posts( $post_type, 'readable' );
$total_posts = array_sum( (array) $num_posts );
- $class = '';
$current_user_id = get_current_user_id();
$all_args = array( 'post_type' => $post_type );
@@ -310,10 +309,6 @@ class WP_Posts_List_Table extends WP_List_Table {
}
if ( $this->user_posts_count && $this->user_posts_count !== $total_posts ) {
- if ( isset( $_GET['author'] ) && ( $current_user_id === (int) $_GET['author'] ) ) {
- $class = 'current';
- }
-
$mine_args = array(
'post_type' => $post_type,
'author' => $current_user_id,
@@ -337,7 +332,6 @@ class WP_Posts_List_Table extends WP_List_Table {
);
$all_args['all_posts'] = 1;
- $class = '';
}
$all_inner_html = sprintf(
@@ -354,7 +348,7 @@ class WP_Posts_List_Table extends WP_List_Table {
$status_links['all'] = array(
'url' => esc_url( add_query_arg( $all_args, 'edit.php' ) ),
'label' => $all_inner_html,
- 'current' => empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ),
+ 'current' => $this->is_base_request() || isset( $_REQUEST['all_posts'] ),
);
if ( $mine ) {
@@ -362,18 +356,12 @@ class WP_Posts_List_Table extends WP_List_Table {
}
foreach ( get_post_stati( array( 'show_in_admin_status_list' => true ), 'objects' ) as $status ) {
- $class = '';
-
$status_name = $status->name;
if ( ! in_array( $status_name, $avail_post_stati, true ) || empty( $num_posts->$status_name ) ) {
continue;
}
- if ( isset( $_REQUEST['post_status'] ) && $status_name === $_REQUEST['post_status'] ) {
- $class = 'current';
- }
-
$status_args = array(
'post_status' => $status_name,
'post_type' => $post_type,
@@ -392,8 +380,6 @@ class WP_Posts_List_Table extends WP_List_Table {
}
if ( ! empty( $this->sticky_posts_count ) ) {
- $class = ! empty( $_REQUEST['show_sticky'] ) ? 'current' : '';
-
$sticky_args = array(
'post_type' => $post_type,
'show_sticky' => 1,
diff --git a/wp-includes/version.php b/wp-includes/version.php
index c75b826da6..b1d33b8960 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-alpha-64338';
+$wp_version = '7.2-alpha-64339';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.