Docs: Update the DocBlock for the wp_media_attach_action
hook per the documentation standards.
Rename the `$att_id` variable to `$attachment_id` for clarity. Follow-up to [47909]. See #49614. git-svn-id: https://develop.svn.wordpress.org/trunk@47913 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
05e1cb8b0b
commit
d4d709856b
@ -3683,7 +3683,7 @@ function wp_get_media_creation_timestamp( $metadata ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulate logic for Attach/Detach actions
|
||||
* Encapsulates the logic for Attach/Detach actions.
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
@ -3706,14 +3706,14 @@ function wp_media_attach_action( $parent_id, $action = 'attach' ) {
|
||||
|
||||
$ids = array();
|
||||
|
||||
foreach ( (array) $_REQUEST['media'] as $att_id ) {
|
||||
$att_id = (int) $att_id;
|
||||
foreach ( (array) $_REQUEST['media'] as $attachment_id ) {
|
||||
$attachment_id = (int) $attachment_id;
|
||||
|
||||
if ( ! current_user_can( 'edit_post', $att_id ) ) {
|
||||
if ( ! current_user_can( 'edit_post', $attachment_id ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ids[] = $att_id;
|
||||
$ids[] = $attachment_id;
|
||||
}
|
||||
|
||||
if ( ! empty( $ids ) ) {
|
||||
@ -3727,19 +3727,19 @@ function wp_media_attach_action( $parent_id, $action = 'attach' ) {
|
||||
}
|
||||
|
||||
if ( isset( $result ) ) {
|
||||
foreach ( $ids as $att_id ) {
|
||||
foreach ( $ids as $attachment_id ) {
|
||||
/**
|
||||
* Fires when media is attached/detached from a post.
|
||||
* Fires when media is attached or detached from a post.
|
||||
*
|
||||
* @since 5.5
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param string $action Attach/detach action.
|
||||
* @param int $att_id The attachment ID.
|
||||
* @param int $parent_id Attachment parent ID.
|
||||
* @param string $action Attach/detach action. Accepts 'attach' or 'detach'.
|
||||
* @param int $attachment_id The attachment ID.
|
||||
* @param int $parent_id Attachment parent ID.
|
||||
*/
|
||||
do_action( 'wp_media_attach_action', $action, $att_id, $parent_id );
|
||||
do_action( 'wp_media_attach_action', $action, $attachment_id, $parent_id );
|
||||
|
||||
clean_attachment_cache( $att_id );
|
||||
clean_attachment_cache( $attachment_id );
|
||||
}
|
||||
|
||||
$location = 'upload.php';
|
||||
|
@ -269,13 +269,13 @@ class WP_Test_REST_Controller extends WP_Test_REST_TestCase {
|
||||
$this->assertArrayHasKey( $property, $args['someobject'] );
|
||||
}
|
||||
|
||||
// ignored properties
|
||||
// Ignored properties.
|
||||
$this->assertArrayNotHasKey( 'ignored_prop', $args['someobject'] );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data_get_fields_for_response,
|
||||
* @dataProvider data_get_fields_for_response
|
||||
*/
|
||||
public function test_get_fields_for_response( $param, $expected ) {
|
||||
$controller = new WP_REST_Test_Controller();
|
||||
|
Loading…
Reference in New Issue
Block a user