WP_Comments_List_Table::column_author( WP_Comment $comment )
- Source
wp-admin/includes/class-wp-comments-list-table.php:979
Compatibility
- WordPress
- core
- 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 comment object.
Performance profile
How much work a call to WP_Comments_List_Table::column_author() 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
- 25–102
- Plugin surface
- 1 hook
- Called by
- 1
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 102.
Third-party callbacks on 'comment_email' run inside this call, and their cost is not bounded by anything here.
1 place 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
Further down the call graph this can also reach option, query, cache, serialize 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 · 40 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Comments_List_Table::column_author() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
empty($author_url_display) | 25 | get_comment_author_url(), untrailingslashit(), comment_author() |
empty($author_url_display) | 31 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author() |
empty($author_url_display) && empty($comment) | 32 | get_comment_author_url(), untrailingslashit(), comment_author(), get_comment_author_IP() |
!empty($author_url_display) | 36 | get_comment_author_url(), untrailingslashit(), comment_author(), esc_url(), esc_html(), printf() |
empty($author_url_display) && empty($comment) | 38 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), get_comment_author_IP() |
empty($author_url_display) && !empty($comment) | 42–44 | get_comment_author_url(), untrailingslashit(), comment_author(), apply_filters(), get_comment_author_IP() |
!empty($author_url_display) | 42 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), esc_url(), esc_html(), printf() |
!empty($author_url_display) && empty($comment) | 43 | get_comment_author_url(), untrailingslashit(), comment_author(), esc_url(), esc_html(), printf(), get_comment_author_IP() |
empty($author_url_display) && !empty($comment) | 48–50 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), apply_filters(), get_comment_author_IP() |
!empty($author_url_display) && empty($comment) | 49 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), esc_url(), esc_html(), printf(), get_comment_author_IP() |
!empty($author_url_display) && !empty($comment) | 53–55 | get_comment_author_url(), untrailingslashit(), comment_author(), esc_url(), esc_html(), printf(), apply_filters(), get_comment_author_IP() |
empty($author_url_display) && empty($comment) && $comment_status !== "spam" | 55 | get_comment_author_url(), untrailingslashit(), comment_author(), get_comment_author_IP(), admin_url(), s(), esc_url(), esc_html(), printf() |
28 further outcomes, up to 102 instructions
empty($author_url_display) && !empty($comment) && !empty($email) && $email !== "@" | 56 | get_comment_author_url(), untrailingslashit(), comment_author(), apply_filters(), esc_url(), esc_html(), printf(), get_comment_author_IP() |
!empty($author_url_display) && !empty($comment) | 59–61 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), esc_url(), esc_html(), printf(), apply_filters(), get_comment_author_IP() |
empty($author_url_display) && empty($comment) && $comment_status === "spam" | 61 | get_comment_author_url(), untrailingslashit(), comment_author(), get_comment_author_IP(), admin_url(), s(), add_query_arg(), esc_url(), esc_html(), printf() |
empty($author_url_display) && empty($comment) && $comment_status !== "spam" | 61 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), get_comment_author_IP(), admin_url(), s(), esc_url(), esc_html(), printf() |
empty($author_url_display) && !empty($comment) && !empty($email) && $email !== "@" | 62 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), apply_filters(), esc_url(), esc_html(), printf(), get_comment_author_IP() |
empty($author_url_display) && !empty($comment) && $comment_status !== "spam" | 65–67 | get_comment_author_url(), untrailingslashit(), comment_author(), apply_filters(), get_comment_author_IP(), admin_url(), s(), esc_url(), esc_html(), printf() |
!empty($author_url_display) && empty($comment) && $comment_status !== "spam" | 66 | get_comment_author_url(), untrailingslashit(), comment_author(), esc_url(), esc_html(), printf(), get_comment_author_IP(), admin_url(), s(), esc_url(), esc_html(), printf() |
!empty($author_url_display) && !empty($comment) && !empty($email) && $email !== "@" | 67 | get_comment_author_url(), untrailingslashit(), comment_author(), esc_url(), esc_html(), printf(), apply_filters(), esc_url(), esc_html(), printf(), get_comment_author_IP() |
empty($author_url_display) && empty($comment) && $comment_status === "spam" | 67 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), get_comment_author_IP(), admin_url(), s(), add_query_arg(), esc_url(), esc_html(), printf() |
empty($author_url_display) && !empty($comment) && $comment_status === "spam" | 71–73 | get_comment_author_url(), untrailingslashit(), comment_author(), apply_filters(), get_comment_author_IP(), admin_url(), s(), add_query_arg(), esc_url(), esc_html(), printf() |
empty($author_url_display) && !empty($comment) && $comment_status !== "spam" | 71–73 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), apply_filters(), get_comment_author_IP(), admin_url(), s(), esc_url(), esc_html(), printf() |
!empty($author_url_display) && empty($comment) && $comment_status === "spam" | 72 | get_comment_author_url(), untrailingslashit(), comment_author(), esc_url(), esc_html(), printf(), get_comment_author_IP(), admin_url(), s(), add_query_arg(), esc_url(), esc_html(), printf() |
!empty($author_url_display) && empty($comment) && $comment_status !== "spam" | 72 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), esc_url(), esc_html(), printf(), get_comment_author_IP(), admin_url(), s(), esc_url(), esc_html(), printf() |
!empty($author_url_display) && !empty($comment) && !empty($email) && $email !== "@" | 73 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), esc_url(), esc_html(), printf(), apply_filters(), esc_url(), esc_html(), printf(), get_comment_author_IP() |
!empty($author_url_display) && !empty($comment) && $comment_status !== "spam" | 76–78 | get_comment_author_url(), untrailingslashit(), comment_author(), esc_url(), esc_html(), printf(), apply_filters(), get_comment_author_IP(), admin_url(), s(), esc_url(), esc_html(), printf() |
empty($author_url_display) && !empty($comment) && $comment_status === "spam" | 77–79 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), apply_filters(), get_comment_author_IP(), admin_url(), s(), add_query_arg(), esc_url(), esc_html(), printf() |
!empty($author_url_display) && empty($comment) && $comment_status === "spam" | 78 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), esc_url(), esc_html(), printf(), get_comment_author_IP(), admin_url(), s(), add_query_arg(), esc_url(), esc_html(), printf() |
empty($author_url_display) && !empty($comment) && !empty($email) && $email !== "@" && $comment_status !== "spam" | 79 | get_comment_author_url(), untrailingslashit(), comment_author(), apply_filters(), esc_url(), esc_html(), printf(), get_comment_author_IP(), admin_url(), s(), esc_url(), esc_html(), printf() |
!empty($author_url_display) && !empty($comment) && $comment_status === "spam" | 82–84 | get_comment_author_url(), untrailingslashit(), comment_author(), esc_url(), esc_html(), printf(), apply_filters(), get_comment_author_IP(), admin_url(), s(), add_query_arg(), esc_url(), esc_html(), printf() |
!empty($author_url_display) && !empty($comment) && $comment_status !== "spam" | 82–84 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), esc_url(), esc_html(), printf(), apply_filters(), get_comment_author_IP(), admin_url(), s(), esc_url(), esc_html(), printf() |
empty($author_url_display) && !empty($comment) && !empty($email) && $email !== "@" && $comment_status === "spam" | 85 | get_comment_author_url(), untrailingslashit(), comment_author(), apply_filters(), esc_url(), esc_html(), printf(), get_comment_author_IP(), admin_url(), s(), add_query_arg(), esc_url(), esc_html(), printf() |
empty($author_url_display) && !empty($comment) && !empty($email) && $email !== "@" && $comment_status !== "spam" | 85 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), apply_filters(), esc_url(), esc_html(), printf(), get_comment_author_IP(), admin_url(), s(), esc_url(), esc_html(), printf() |
!empty($author_url_display) && !empty($comment) && $comment_status === "spam" | 88–90 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), esc_url(), esc_html(), printf(), apply_filters(), get_comment_author_IP(), admin_url(), s(), add_query_arg(), esc_url(), esc_html(), printf() |
!empty($author_url_display) && !empty($comment) && !empty($email) && $email !== "@" && $comment_status !== "spam" | 90 | get_comment_author_url(), untrailingslashit(), comment_author(), esc_url(), esc_html(), printf(), apply_filters(), esc_url(), esc_html(), printf(), get_comment_author_IP(), admin_url(), s(), esc_url(), esc_html(), printf() |
empty($author_url_display) && !empty($comment) && !empty($email) && $email !== "@" && $comment_status === "spam" | 91 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), apply_filters(), esc_url(), esc_html(), printf(), get_comment_author_IP(), admin_url(), s(), add_query_arg(), esc_url(), esc_html(), printf() |
!empty($author_url_display) && !empty($comment) && !empty($email) && $email !== "@" && $comment_status === "spam" | 96 | get_comment_author_url(), untrailingslashit(), comment_author(), esc_url(), esc_html(), printf(), apply_filters(), esc_url(), esc_html(), printf(), get_comment_author_IP(), admin_url(), s(), add_query_arg(), esc_url(), esc_html(), printf() |
!empty($author_url_display) && !empty($comment) && !empty($email) && $email !== "@" && $comment_status !== "spam" | 96 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), esc_url(), esc_html(), printf(), apply_filters(), esc_url(), esc_html(), printf(), get_comment_author_IP(), admin_url(), s(), esc_url(), esc_html(), printf() |
!empty($author_url_display) && !empty($comment) && !empty($email) && $email !== "@" && $comment_status === "spam" | 102 | get_comment_author_url(), untrailingslashit(), wp_html_excerpt(), comment_author(), esc_url(), esc_html(), printf(), apply_filters(), esc_url(), esc_html(), printf(), get_comment_author_IP(), admin_url(), s(), add_query_arg(), esc_url(), esc_html(), printf() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 103 | 25–103 | 8 | 1 more instruction than PHP 8.5 |
| 8.5 | 102 | 25–102 | 8 | |
| 8.4 | 102 | 25–102 | 8 | 3 fewer instructions than PHP 8.3 |
| 8.3 | 105 | 28–105 | 8 | |
| 8.2 | 105 | 28–105 | 8 | |
| 8.1 | 105 | 28–105 | 8 | |
| 7.4 | 105 | 28–105 | 8 |
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_Comments_List_Table::column_author() runs, in this order:
- apply_filters( comment_email )filterline 1006 (+27 into the body)
Filters the comment author's email for display.
Uses · 10
- get_comment_author_url()Retrieves the URL of the author of the current comment, not linked.
- untrailingslashit()Removes trailing forward slashes and backslashes if they exist.
- wp_html_excerpt()Safely extracts not more than the first $count characters from HTML string.
- comment_author()Displays the author of the current comment.
- esc_url()Checks and cleans a URL.
- esc_html()Escaping for HTML blocks.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- get_comment_author_IP()Retrieves the IP address of the author of the current comment.
- add_query_arg()Retrieves a modified URL query string.
- admin_url()Retrieves the URL to the admin area for the current site.
Used by · 1
Source code
public function column_author( $comment ) { global $comment_status; $author_url = get_comment_author_url( $comment ); $author_url_display = untrailingslashit( preg_replace( '|^http(s)?://(www\.)?|i', '', $author_url ) ); if ( strlen( $author_url_display ) > 50 ) { $author_url_display = wp_html_excerpt( $author_url_display, 49, '…' ); } echo '<strong>'; comment_author( $comment ); echo '</strong><br />'; if ( ! empty( $author_url_display ) ) { // Print link to author URL, and disallow referrer information (without using target="_blank"). printf( '<a href="%s" rel="noopener noreferrer">%s</a><br />', esc_url( $author_url ), esc_html( $author_url_display ) ); } if ( $this->user_can ) { if ( ! empty( $comment->comment_author_email ) ) { /** This filter is documented in wp-includes/comment-template.php */ $email = apply_filters( 'comment_email', $comment->comment_author_email, $comment ); if ( ! empty( $email ) && '@' !== $email ) { printf( '<a href="%1$s">%2$s</a><br />', esc_url( 'mailto:' . $email ), esc_html( $email ) ); } } $author_ip = get_comment_author_IP( $comment ); if ( $author_ip ) { $author_ip_url = add_query_arg( array( 's' => $author_ip, 'mode' => 'detail', ), admin_url( 'edit-comments.php' ) ); if ( 'spam' === $comment_status ) { $author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url ); } printf( '<a href="%1$s">%2$s</a>', esc_url( $author_ip_url ), esc_html( $author_ip ) ); } } }Changelog
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/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.