diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-admin/includes/class-wp-posts-list-table.php --- a/wp/wp-admin/includes/class-wp-posts-list-table.php Thu Sep 29 08:06:27 2022 +0200 +++ b/wp/wp-admin/includes/class-wp-posts-list-table.php Fri Sep 05 18:40:08 2025 +0200 @@ -11,7 +11,6 @@ * Core class used to implement displaying posts in a list table. * * @since 3.1.0 - * @access private * * @see WP_List_Table */ @@ -66,7 +65,7 @@ * * @see WP_List_Table::__construct() for more information on default arguments. * - * @global WP_Post_Type $post_type_object + * @global WP_Post_Type $post_type_object Global post type object. * @global wpdb $wpdb WordPress database abstraction object. * * @param array $args An associative array of arguments. @@ -227,7 +226,7 @@ } /** - * Determine if the current view is the "All" view. + * Determines if the current view is the "All" view. * * @since 4.2.0 * @@ -247,7 +246,7 @@ } /** - * Helper to create links to edit.php with params. + * Creates a link to edit.php with params. * * @since 4.4.0 * @@ -331,16 +330,16 @@ number_format_i18n( $this->user_posts_count ) ); - $mine = $this->get_edit_link( $mine_args, $mine_inner_html, $class ); + $mine = array( + 'url' => esc_url( add_query_arg( $mine_args, 'edit.php' ) ), + 'label' => $mine_inner_html, + 'current' => isset( $_GET['author'] ) && ( $current_user_id === (int) $_GET['author'] ), + ); $all_args['all_posts'] = 1; $class = ''; } - if ( empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ) ) { - $class = 'current'; - } - $all_inner_html = sprintf( /* translators: %s: Number of posts. */ _nx( @@ -352,7 +351,11 @@ number_format_i18n( $total_posts ) ); - $status_links['all'] = $this->get_edit_link( $all_args, $all_inner_html, $class ); + $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'] ) ), + ); if ( $mine ) { $status_links['mine'] = $mine; @@ -381,7 +384,11 @@ number_format_i18n( $num_posts->$status_name ) ); - $status_links[ $status_name ] = $this->get_edit_link( $status_args, $status_label, $class ); + $status_links[ $status_name ] = array( + 'url' => esc_url( add_query_arg( $status_args, 'edit.php' ) ), + 'label' => $status_label, + 'current' => isset( $_REQUEST['post_status'] ) && $status_name === $_REQUEST['post_status'], + ); } if ( ! empty( $this->sticky_posts_count ) ) { @@ -404,7 +411,11 @@ ); $sticky_link = array( - 'sticky' => $this->get_edit_link( $sticky_args, $sticky_inner_html, $class ), + 'sticky' => array( + 'url' => esc_url( add_query_arg( $sticky_args, 'edit.php' ) ), + 'label' => $sticky_inner_html, + 'current' => ! empty( $_REQUEST['show_sticky'] ), + ), ); // Sticky comes after Publish, or if not listed, after All. @@ -412,7 +423,7 @@ $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) ); } - return $status_links; + return $this->get_views_links( $status_links ); } /** @@ -523,7 +534,12 @@ $displayed_post_format = isset( $_GET['post_format'] ) ? $_GET['post_format'] : ''; ?> - + + -
current_level++; + ++$this->current_level; $find_main_page = (int) $parent->post_parent; if ( ! isset( $parent_name ) ) { @@ -1124,7 +1168,12 @@ } } - get_inline_data( $post ); + /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */ + $quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_post_type', true, $post->post_type ); + + if ( $quick_edit_enabled ) { + get_inline_data( $post ); + } } /** @@ -1185,7 +1234,7 @@ } /** - * Filters the published time of the post. + * Filters the published, scheduled, or unpublished time of the post. * * @since 2.5.1 * @since 5.5.0 Removed the difference between 'excerpt' and 'list' modes. @@ -1251,7 +1300,7 @@ $taxonomy = 'category'; } elseif ( 'tags' === $column_name ) { $taxonomy = 'post_tag'; - } elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) { + } elseif ( str_starts_with( $column_name, 'taxonomy-' ) ) { $taxonomy = substr( $column_name, 9 ); } else { $taxonomy = false; @@ -1415,7 +1464,8 @@ } // Restores the more descriptive, specific name for use within this method. - $post = $item; + $post = $item; + $post_type_object = get_post_type_object( $post->post_type ); $can_edit_post = current_user_can( 'edit_post', $post->ID ); $actions = array(); @@ -1430,7 +1480,17 @@ __( 'Edit' ) ); - if ( 'wp_block' !== $post->post_type ) { + /** + * Filters whether Quick Edit should be enabled for the given post type. + * + * @since 6.4.0 + * + * @param bool $enable Whether to enable the Quick Edit functionality. Default true. + * @param string $post_type Post type name. + */ + $quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_post_type', true, $post->post_type ); + + if ( $quick_edit_enabled && 'wp_block' !== $post->post_type ) { $actions['inline hide-if-no-js'] = sprintf( '', /* translators: %s: Post title. */ @@ -2033,16 +2093,23 @@ - +

', + array( + 'type' => 'error', + 'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ), + 'paragraph_wrap' => false, + ) + ); + ?>