attachment_fields_to_edit WordPress Filter Hook

The attachment_fields_to_edit hook is used to add custom fields to the attachment edit screen in the WordPress admin. This hook can be used to add fields for extra data to be stored with an attachment, such as credit information or a link to the original file.

apply_filters( 'attachment_fields_to_edit', array $form_fields, WP_Post $post ) #

Filters the attachment fields to edit.


Parameters

$form_fields

(array)An array of attachment form fields.

$post

(WP_Post)The WP_Post attachment object.


Top ↑

More Information

  • WordPress does not pass standard fields through this filter, though this can still be used for adding attachment form fields.
  • Note that the filter function must return an array of attachment form fields after it is finished processing; otherwise, no fields will be displayed when editing an attachment and other plugins also filtering the $form_fields array may generate errors.

Top ↑

Source

File: wp-admin/includes/media.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
2.5.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.

Show More
Show More