_wp_dashboard_recent_comments_row( WP_Comment $comment, bool $show_date = true )
- Since
- 2.7.0
- Source
wp-admin/includes/dashboard.php:704
Compatibility
- WordPress
- since 2.7.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.
Parameters
$commentWP_Comment- The current comment.
$show_datebooloptional- Whether to display the date.Default:
true
Performance profile
How much work a call to _wp_dashboard_recent_comments_row() 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
- Heavy
- Scaling
- Scales with input
- Instructions
- 73–350
- Plugin surface
- 1 hook
- Called by
- 2
Reads stored settings via get_option(), cached per request but not free on a cold cache.
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 480.
Third-party callbacks on 'comment_row_actions' run inside this call, and their cost is not bounded by anything here.
2 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- hookthird-party callbacks
apply_filters()called directly - optionoption read or write
get_option()called directly - cacheobject cache
wp_cache_get()one call below _wp_dashboard_recent_comments_row() - serializeserialisation
maybe_unserialize()one call below _wp_dashboard_recent_comments_row()
Further down the call graph this can also reach query and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 30 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost _wp_dashboard_recent_comments_row() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!current_user_can() && !get_option() | 73–81 | current_user_can(), wp_get_comment_status(), comment-item(), get_option(), __(), get_comment_author_link(), __(), printf(), comment_excerpt() |
!current_user_can() && get_option() | 80–88 | current_user_can(), wp_get_comment_status(), comment-item(), get_option(), get_avatar(), __(), get_comment_author_link(), __(), printf(), comment_excerpt() |
!current_user_can() && !get_option() && $comment | 88–97 | current_user_can(), wp_get_comment_status(), comment-item(), get_option(), __(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
!current_user_can() && !get_option() && $comment | 88–98 | current_user_can(), wp_get_comment_status(), comment-item(), get_option(), ucwords(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
!current_user_can() && !get_option() | 92–100 | _draft_or_post_title(), get_the_permalink(), esc_url(), current_user_can(), wp_get_comment_status(), comment-item(), get_option(), __(), get_comment_author_link(), __(), printf(), comment_excerpt() |
!current_user_can() && get_option() && $comment | 95–104 | current_user_can(), wp_get_comment_status(), comment-item(), get_option(), get_avatar(), __(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
!current_user_can() && get_option() && $comment | 95–105 | current_user_can(), wp_get_comment_status(), comment-item(), get_option(), get_avatar(), ucwords(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
!current_user_can() && get_option() | 99–107 | _draft_or_post_title(), get_the_permalink(), esc_url(), current_user_can(), wp_get_comment_status(), comment-item(), get_option(), get_avatar(), __(), get_comment_author_link(), __(), printf(), comment_excerpt() |
!current_user_can() && !get_option() && $comment | 107–116 | _draft_or_post_title(), get_the_permalink(), esc_url(), current_user_can(), wp_get_comment_status(), comment-item(), get_option(), __(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
!current_user_can() && !get_option() && $comment | 107–117 | _draft_or_post_title(), get_the_permalink(), esc_url(), current_user_can(), wp_get_comment_status(), comment-item(), get_option(), ucwords(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
!current_user_can() && get_option() && $comment | 114–123 | _draft_or_post_title(), get_the_permalink(), esc_url(), current_user_can(), wp_get_comment_status(), comment-item(), get_option(), get_avatar(), __(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
!current_user_can() && get_option() && $comment | 114–124 | _draft_or_post_title(), get_the_permalink(), esc_url(), current_user_can(), wp_get_comment_status(), comment-item(), get_option(), get_avatar(), ucwords(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
18 further outcomes, up to 350 instructions
current_user_can() && !get_option() | 299–308 | current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), _x(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), __(), get_comment_author_link(), __(), printf(), comment_excerpt() |
current_user_can() && !get_option() | 299–308 | current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), __(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), __(), get_comment_author_link(), __(), printf(), comment_excerpt() |
current_user_can() && get_option() | 306–315 | current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), _x(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), get_avatar(), __(), get_comment_author_link(), __(), printf(), comment_excerpt() |
current_user_can() && get_option() | 306–315 | current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), __(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), get_avatar(), __(), get_comment_author_link(), __(), printf(), comment_excerpt() |
current_user_can() && !get_option() && $comment | 314–324 | current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), _x(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), __(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
current_user_can() && !get_option() && $comment | 314–325 | current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), _x(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), ucwords(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
current_user_can() && !get_option() && $comment | 314–324 | current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), __(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), __(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
current_user_can() && !get_option() && $comment | 314–325 | current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), __(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), ucwords(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
current_user_can() && !get_option() | 318–327 | _draft_or_post_title(), get_the_permalink(), esc_url(), current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), _x(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), __(), get_comment_author_link(), __(), printf(), comment_excerpt() |
current_user_can() && get_option() && $comment | 321–331 | current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), _x(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), get_avatar(), __(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
current_user_can() && get_option() && $comment | 321–332 | current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), _x(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), get_avatar(), ucwords(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
current_user_can() && get_option() && $comment | 321–331 | current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), __(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), get_avatar(), __(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
current_user_can() && get_option() && $comment | 321–332 | current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), __(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), get_avatar(), ucwords(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
current_user_can() && get_option() | 325–333 | _draft_or_post_title(), get_the_permalink(), esc_url(), current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), _x(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), get_avatar(), __(), get_comment_author_link(), __(), printf(), comment_excerpt() |
current_user_can() && !get_option() && $comment | 333–343 | _draft_or_post_title(), get_the_permalink(), esc_url(), current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), _x(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), __(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
current_user_can() && !get_option() && $comment | 333–344 | _draft_or_post_title(), get_the_permalink(), esc_url(), current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), _x(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), ucwords(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
current_user_can() && get_option() && $comment | 340–349 | _draft_or_post_title(), get_the_permalink(), esc_url(), current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), _x(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), get_avatar(), __(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
current_user_can() && get_option() && $comment | 340–350 | _draft_or_post_title(), get_the_permalink(), esc_url(), current_user_can(), wp_create_nonce(), esc_html(), wp_create_nonce(), esc_html(), sprintf(), sprintf(), sprintf(), sprintf(), sprintf(), esc_url(), esc_attr__(), __(), esc_url(), esc_attr__(), __(), esc_attr__(), __(), esc_attr__(), __(), esc_url(), esc_attr__(), _x(), esc_url(), esc_attr__(), _x(), get_comment_link(), esc_url(), esc_attr__(), __(), array_filter(), apply_filters(), wp_get_comment_status(), comment-item(), get_option(), get_avatar(), ucwords(), esc_html(), _x(), __(), printf(), comment_author_link(), comment_excerpt() |
This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 480 | 73–350 | 22 | |
| 8.5 | 480 | 73–350 | 22 | |
| 8.4 | 480 | 73–350 | 22 | 14 more instructions than PHP 8.3 |
| 8.3 | 466 | 73–338 | 22 | |
| 8.2 | 466 | 73–338 | 22 | 1 more instruction than PHP 8.1 |
| 8.1 | 465 | 73–337 | 22 | 2 fewer instructions than PHP 7.4 |
| 7.4 | 467 | 75–339 | 22 |
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.
Hooks and filters fired · 1
One hook fires while _wp_dashboard_recent_comments_row() runs, in this order:
- apply_filters( comment_row_actions )filterline 806 (+102 into the body)
Filters the action links displayed for each comment in the Comments list table.
Uses · 18
- _draft_or_post_title()Gets the post title.
- get_the_permalink()Retrieves the full permalink for the current post or post ID.
- esc_url()Checks and cleans a URL.
- current_user_can()Returns whether the current user has the specified capability.
- esc_html()Escaping for HTML blocks.
- wp_create_nonce()Creates a cryptographic token tied to a specific action, user, user session, and window of time.
- esc_attr__()Retrieves the translation of $text and escapes it for safe use in an attribute.
- __()Retrieves the translation of $text.
- _x()Retrieves translated string with gettext context.
- get_comment_link()Retrieves the link to a given comment.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- comment_class()Generates semantic classes for each comment element.
Show all 18
- wp_get_comment_status()Retrieves the status of a comment by comment ID.
- get_option()Retrieves an option value based on an option name.
- get_avatar()Retrieves the avatar `` tag for a user, email address, MD5 hash, comment, or post.
- get_comment_author_link()Retrieves the HTML link to the URL of the author of the current comment.
- comment_author_link()Displays the HTML link to the URL of the author of the current comment.
- comment_excerpt()Displays the excerpt of the current comment.
Used by · 2
- wp_ajax_replyto_comment()Handles replying to a comment via AJAX.
- wp_dashboard_recent_comments()Show Comments section.
Source code
function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { $GLOBALS['comment'] = clone $comment; if ( $comment->comment_post_ID > 0 ) { $comment_post_title = _draft_or_post_title( $comment->comment_post_ID ); $comment_post_url = get_the_permalink( $comment->comment_post_ID ); $comment_post_link = '<a href="' . esc_url( $comment_post_url ) . '">' . $comment_post_title . '</a>'; } else { $comment_post_link = ''; } $actions_string = ''; if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) { // Pre-order it: Approve | Reply | Edit | Spam | Trash. $actions = array( 'approve' => '', 'unapprove' => '', 'reply' => '', 'edit' => '', 'spam' => '', 'trash' => '', 'delete' => '', 'view' => '', ); $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'approve-comment_' . $comment->comment_ID ) ); $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'delete-comment_' . $comment->comment_ID ) ); $action_string = 'comment.php?action=%s&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID . '&%s'; $approve_url = sprintf( $action_string, 'approvecomment', $approve_nonce ); $unapprove_url = sprintf( $action_string, 'unapprovecomment', $approve_nonce ); $spam_url = sprintf( $action_string, 'spamcomment', $del_nonce ); $trash_url = sprintf( $action_string, 'trashcomment', $del_nonce ); $delete_url = sprintf( $action_string, 'deletecomment', $del_nonce ); $actions['approve'] = sprintf( '<a href="%s" data-wp-lists="%s" class="vim-a aria-button-if-js" aria-label="%s">%s</a>', esc_url( $approve_url ), "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=approved", esc_attr__( 'Approve this comment' ), __( 'Approve' ) ); $actions['unapprove'] = sprintf( '<a href="%s" data-wp-lists="%s" class="vim-u aria-button-if-js" aria-label="%s">%s</a>', esc_url( $unapprove_url ), "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=unapproved", esc_attr__( 'Unapprove this comment' ), __( 'Unapprove' ) ); $actions['edit'] = sprintf( '<a href="%s" aria-label="%s">%s</a>', "comment.php?action=editcomment&c={$comment->comment_ID}", esc_attr__( 'Edit this comment' ), __( 'Edit' ) ); $actions['reply'] = sprintf( '<button type="button" onclick="window.commentReply && commentReply.open(\'%s\',\'%s\');" class="vim-r button-link hide-if-no-js" aria-label="%s">%s</button>', $comment->comment_ID, $comment->comment_post_ID, esc_attr__( 'Reply to this comment' ), __( 'Reply' ) ); $actions['spam'] = sprintf( '<a href="%s" data-wp-lists="%s" class="vim-s vim-destructive aria-button-if-js" aria-label="%s">%s</a>', esc_url( $spam_url ), "delete:the-comment-list:comment-{$comment->comment_ID}::spam=1", esc_attr__( 'Mark this comment as spam' ), /* translators: "Mark as spam" link. */ _x( 'Spam', 'verb' ) ); if ( ! EMPTY_TRASH_DAYS ) { $actions['delete'] = sprintf( '<a href="%s" data-wp-lists="%s" class="delete vim-d vim-destructive aria-button-if-js" aria-label="%s">%s</a>', esc_url( $delete_url ),Changelog
Introduced in 2.7.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.7.7 tag, from
src/wp-admin/includes/dashboard.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.