Make WordPress Core

Opened 7 months ago

Last modified 3 weeks ago

#64602 new enhancement

Document WP_List_Table behavior change in WordPress 6.9 - bottom tablenav skipped when empty

Reported by: nithi22 Owned by:
Priority: normal Milestone: Awaiting Review
Component: Administration Version:
Severity: normal Keywords: needs-docs has-patch
Cc: Focuses:

Description

Summary

WordPress 6.9 introduced a behavior change in WP_List_Table::display_tablenav() that affects plugins using the manage_posts_extra_tablenav hook.

The Change

In WP 6.9, the following code was added to display_tablenav():

if ( 'bottom' === $which && ! $this->has_items() ) {
    return;
}

This optimization skips rendering the bottom tablenav entirely when there are no items in the list table.

Impact on Plugins

Plugins that hook into manage_posts_extra_tablenav with $which === 'bottom' to display custom empty states or notices will find their code no longer executes when the list is empty.

Example affected code:

add_action( 'manage_posts_extra_tablenav', 'my_empty_state' );

function my_empty_state( $which ) {
    global $post_type;
    
    if ( $post_type === 'my_cpt' && $which === 'bottom' ) {
        if ( empty_list_condition() ) {
            // This never fires in WP 6.9 when list is empty
            display_empty_state();
        }
    }
}

Request

This should be documented in:

  1. WordPress 6.9 Developer Notes / Field Guide
  2. Hook documentation for manage_posts_extra_tablenav
  3. WP_List_Table class documentation

Suggested Documentation

For the manage_posts_extra_tablenav hook documentation:

"Note: As of WordPress 6.9, this action will not fire for $which === 'bottom' when the list has no items (has_items() returns false).

Change History (2)

This ticket was mentioned in Slack in #core by nithi22. View the logs.


7 months ago

This ticket was mentioned in PR #13258 on WordPress/wordpress-develop by @irozum.


3 weeks ago
#2

  • Keywords has-patch added

What changed: Adds an @since 6.9.0 docblock note to two places affected by [7dae010b65] (Fixes #63369), which made WP_List_Table::display_tablenav() skip rendering the bottom tablenav container entirely when the list table has no items:

  • WP_List_Table::display_tablenav() in class-wp-list-table.php
  • The manage_posts_extra_tablenav action docblock in class-wp-posts-list-table.php

Why: As reported on the ticket, plugins hooking into manage_posts_extra_tablenav with $which === 'bottom' (e.g. to render a custom empty-state notice) will find that code silently stops firing when the list is empty, since the entire bottom container — including this action — is now skipped. That's existing, intentional behavior from 6.9, but it wasn't documented on the hook or the method that causes it, so this only adds the missing @since notes; no behavior changes.

## Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5
Used for: Ticket triage, locating the relevant hook/method and confirming the behavior change via git history, and drafting the docblock updates. All changes were reviewed by me before submitting.

Note: See TracTickets for help on using tickets.