Make WordPress Core

Opened 5 weeks ago

Last modified 5 weeks ago

#64602 new enhancement

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

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

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 (1)

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


5 weeks ago

Note: See TracTickets for help on using tickets.