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



wp_update_attachment_metadata ›

Desde2.1.0
Obsoleton/a
wp_update_attachment_metadata ( $post_id, $data )
Parâmetros: (2)
  • (int) $post_id Attachment ID.
    Required: Yes
  • (array) $data Attachment data.
    Required: Yes
Retorna:
  • (int|bool) False if $post is invalid.
Definido em:
Codex:

Update metadata for an attachment.



Fonte

function wp_update_attachment_metadata( $post_id, $data ) {
	$post_id = (int) $post_id;
	if ( !$post = get_post( $post_id ) )
		return false;

	/**
	 * Filters the updated attachment meta data.
	 *
	 * @since 2.1.0
	 *
	 * @param array $data    Array of updated attachment meta data.
	 * @param int   $post_id Attachment ID.
	 */
	if ( $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ) )
		return update_post_meta( $post->ID, '_wp_attachment_metadata', $data );
	else
		return delete_post_meta( $post->ID, '_wp_attachment_metadata' );
}