WP_Comments_List_Table::display()
- Since
- 3.1.0
- Source
wp-admin/includes/class-wp-comments-list-table.php:579
Description
Overrides the parent display() method to render extra comments.
Compatibility
- WordPress
- since 3.1.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Performance profile
How much work a call to WP_Comments_List_Table::display() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Trivial
- Scaling
- Constant
- Instructions
- 49–61
- Plugin surface
- None
- Called by
- 0
Touches nothing outside its own arguments.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 63.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What one call costs · 6 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Comments_List_Table::display() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
isset($has_items) && isset($value) | 49 | wp_nonce_field(), ->render_screen_reader_content(), ->get_table_classes(), ->print_table_description(), ->print_column_headers(), ->display_rows_or_placeholder(), ->display_rows_or_placeholder(), ->print_column_headers(), ->display_tablenav() |
!isset($has_items) && isset($value) | 53 | wp_nonce_field(), ->has_items(), ->render_screen_reader_content(), ->get_table_classes(), ->print_table_description(), ->print_column_headers(), ->display_rows_or_placeholder(), ->display_rows_or_placeholder(), ->print_column_headers(), ->display_tablenav() |
isset($has_items) && !isset($value) | 54 | wp_nonce_field(), ->render_screen_reader_content(), ->get_table_classes(), __(), ->print_column_headers(), ->display_rows_or_placeholder(), ->display_rows_or_placeholder(), ->print_column_headers(), ->display_tablenav() |
!isset($has_items) && isset($value) | 56 | wp_nonce_field(), ->has_items(), ->display_tablenav(), ->render_screen_reader_content(), ->get_table_classes(), ->print_table_description(), ->print_column_headers(), ->display_rows_or_placeholder(), ->display_rows_or_placeholder(), ->print_column_headers(), ->display_tablenav() |
!isset($has_items) && !isset($value) | 58 | wp_nonce_field(), ->has_items(), ->render_screen_reader_content(), ->get_table_classes(), __(), ->print_column_headers(), ->display_rows_or_placeholder(), ->display_rows_or_placeholder(), ->print_column_headers(), ->display_tablenav() |
!isset($has_items) && !isset($value) | 61 | wp_nonce_field(), ->has_items(), ->display_tablenav(), ->render_screen_reader_content(), ->get_table_classes(), __(), ->print_column_headers(), ->display_rows_or_placeholder(), ->display_rows_or_placeholder(), ->print_column_headers(), ->display_tablenav() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 63 | 49–61 | 3 | |
| 8.5 | 63 | 49–61 | 3 | |
| 8.4 | 63 | 49–61 | 3 | 3 fewer instructions than PHP 8.3 |
| 8.3 | 66 | 52–64 | 3 | |
| 8.2 | 66 | 52–64 | 3 | |
| 8.1 | 66 | 52–64 | 3 | |
| 7.4 | 66 | 52–64 | 3 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 8
- wp_nonce_field()Retrieves or display nonce hidden field for forms.
- __()Retrieves the translation of $text.
- WP_Comments_List_Table::has_items()
- WP_Comments_List_Table::display_tablenav()
- WP_Comments_List_Table::get_table_classes()
- WP_Comments_List_Table::print_table_description()
- WP_Comments_List_Table::print_column_headers()
- WP_Comments_List_Table::display_rows_or_placeholder()
Source code
public function display() { wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' ); static $has_items; if ( ! isset( $has_items ) ) { $has_items = $this->has_items(); if ( $has_items ) { $this->display_tablenav( 'top' ); } } $this->screen->render_screen_reader_content( 'heading_list' ); ?><table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>"> <?php if ( ! isset( $_GET['orderby'] ) ) { // In the initial view, Comments are ordered by comment's date but there's no column for that. echo '<caption class="screen-reader-text">' . /* translators: Hidden accessibility text. */ __( 'Ordered by Comment Date, descending.' ) . '</caption>'; } else { $this->print_table_description(); } ?> <thead> <tr> <?php $this->print_column_headers(); ?> </tr> </thead> <tbody id="the-comment-list" data-wp-lists="list:comment"> <?php $this->display_rows_or_placeholder(); ?> </tbody> <tbody id="the-extra-comment-list" data-wp-lists="list:comment" style="display: none;"> <?php /* * Back up the items to restore after printing the extra items markup. * The extra items may be empty, which will prevent the table nav from displaying later. */ $items = $this->items; $this->items = $this->extra_items; $this->display_rows_or_placeholder(); $this->items = $items; ?> </tbody> <tfoot> <tr> <?php $this->print_column_headers( false ); ?> </tr> </tfoot> </table> <?php $this->display_tablenav( 'bottom' ); }Changelog
Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 tag, from
src/wp-admin/includes/class-wp-comments-list-table.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.