wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema



update_post_author_caches › WordPress Function

Desde6.1.0
Obsoleton/a
update_post_author_caches ( $posts )
Parâmetros:
  • (WP_Post[]) $posts Array of post objects.
    Required: Yes
Definido em:
Codex:

Updates post author user caches for a list of post objects.



Fonte

function update_post_author_caches( $posts ) {
	/*
	 * cache_users() is a pluggable function so is not available prior
	 * to the `plugins_loaded` hook firing. This is to ensure against
	 * fatal errors when the function is not available.
	 */
	if ( ! function_exists( 'cache_users' ) ) {
		return;
	}

	$author_ids = wp_list_pluck( $posts, 'post_author' );
	$author_ids = array_map( 'absint', $author_ids );
	$author_ids = array_unique( array_filter( $author_ids ) );

	cache_users( $author_ids );
}