wp_generate_attachment_metadata WordPress Filter Hook

The wp_generate_attachment_metadata hook is used to generate metadata for an attachment. This hook is called whenever an attachment is created or updated.

apply_filters( 'wp_generate_attachment_metadata', array $metadata, int $attachment_id, string $context ) #

Filters the generated attachment meta data.


Parameters

$metadata

(array)An array of attachment meta data.

$attachment_id

(int)Current attachment ID.

$context

(string)Additional context. Can be 'create' when metadata was initially created for new attachment or 'update' when the metadata was updated.


Top ↑

Source

File: wp-admin/includes/image.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.3.0The $context parameter was added.
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.