twentyfourteen_list_authors()
- Since
- Twenty Fourteen 1.0
- Source
wp-content/themes/twentyfourteen/functions.php:537
Compatibility
- WordPress
- since Twenty Fourteen 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 twentyfourteen_list_authors() 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
- 20–23
- Plugin surface
- 1 hook
- Called by
- 0
Reaches the database via get_users().
The body loops, so the work grows with how much data it finds.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 67.
Third-party callbacks on 'twentyfourteen_list_authors_query_args' run inside this call, and their cost is not bounded by anything here.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- hookthird-party callbacks
apply_filters()called directly - querycontent query
get_users()called directly - cacheobject cache
wp_cache_get_last_changed()one call below twentyfourteen_list_authors() - optionoption read or write
get_option()one call below twentyfourteen_list_authors()
Further down the call graph this can also reach 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 · 1 distinct outcome
One number would be a lie: the work depends on which branch runs. These are every distinct cost twentyfourteen_list_authors() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 20–23 | version_compare(), apply_filters(), get_users() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 67 | 20–23 | 4 | |
| 8.5 | 67 | 20–23 | 4 | |
| 8.4 | 67 | 20–23 | 4 | |
| 8.3 | 67 | 20–23 | 4 | |
| 8.2 | 67 | 20–23 | 4 | |
| 8.1 | 67 | 20–23 | 4 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 68 | 21–24 | 4 |
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 twentyfourteen_list_authors() runs, in this order:
- apply_filters( twentyfourteen_list_authors_query_args )filterline 558 (+21 into the body)
Filters query arguments for listing authors.
Uses · 8
- apply_filters()Calls the callback functions that have been added to a filter hook.
- get_users()Retrieves list of users matching criteria.
- count_user_posts()Gets the number of posts a user has written.
- get_avatar()Retrieves the avatar `` tag for a user, email address, MD5 hash, comment, or post.
- get_the_author_meta()Retrieves the requested data of the author of the current post.
- esc_url()Checks and cleans a URL.
- get_author_posts_url()Retrieves the URL to the author page for the user with the ID provided.
- _n()Translates and retrieves the singular or plural form based on the supplied number.
Source code
function twentyfourteen_list_authors() { $args = array( 'fields' => 'ID', 'orderby' => 'post_count', 'order' => 'DESC', 'capability' => array( 'edit_posts' ), ); // Capability queries were only introduced in WP 5.9. if ( version_compare( $GLOBALS['wp_version'], '5.9-alpha', '<' ) ) { $args['who'] = 'authors'; unset( $args['capability'] ); } /** * Filters query arguments for listing authors. * * @since Twenty Fourteen 3.3 * * @param array $args Query arguments. */ $args = apply_filters( 'twentyfourteen_list_authors_query_args', $args ); $contributor_ids = get_users( $args ); foreach ( $contributor_ids as $contributor_id ) : $post_count = count_user_posts( $contributor_id ); // Move on if user has not published a post (yet). if ( ! $post_count ) { continue; } ?> <div class="contributor"> <div class="contributor-info"> <div class="contributor-avatar"><?php echo get_avatar( $contributor_id, 132 ); ?></div> <div class="contributor-summary"> <h2 class="contributor-name"><?php echo get_the_author_meta( 'display_name', $contributor_id ); ?></h2> <p class="contributor-bio"> <?php echo get_the_author_meta( 'description', $contributor_id ); ?> </p> <a class="button contributor-posts-link" href="<?php echo esc_url( get_author_posts_url( $contributor_id ) ); ?>"> <?php /* translators: %d: Post count. */ printf( _n( '%d Article', '%d Articles', $post_count, 'twentyfourteen' ), $post_count ); ?> </a> </div><!-- .contributor-summary --> </div><!-- .contributor-info --> </div><!-- .contributor --> <?php endforeach; }Changelog
Introduced in Twenty Fourteen 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 7.1.0 tag, from
src/wp-content/themes/twentyfourteen/functions.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.