Make WordPress Core

Changeset 47913


Ignore:
Timestamp:
06/05/2020 08:28:42 AM (5 years ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r47909 r47913  
    36843684
    36853685/**
    3686  * Encapsulate logic for Attach/Detach actions
     3686 * Encapsulates the logic for Attach/Detach actions.
    36873687 *
    36883688 * @since 4.2.0
     
    37073707    $ids = array();
    37083708
    3709     foreach ( (array) $_REQUEST['media'] as $att_id ) {
    3710         $att_id = (int) $att_id;
    3711 
    3712         if ( ! current_user_can( 'edit_post', $att_id ) ) {
     3709    foreach ( (array) $_REQUEST['media'] as $attachment_id ) {
     3710        $attachment_id = (int) $attachment_id;
     3711
     3712        if ( ! current_user_can( 'edit_post', $attachment_id ) ) {
    37133713            continue;
    37143714        }
    37153715
    3716         $ids[] = $att_id;
     3716        $ids[] = $attachment_id;
    37173717    }
    37183718
     
    37283728
    37293729    if ( isset( $result ) ) {
    3730         foreach ( $ids as $att_id ) {
     3730        foreach ( $ids as $attachment_id ) {
    37313731            /**
    3732              * Fires when media is attached/detached from a post.
     3732             * Fires when media is attached or detached from a post.
    37333733             *
    3734              * @since 5.5
     3734             * @since 5.5.0
    37353735             *
    3736              * @param string $action    Attach/detach action.
    3737              * @param int    $att_id    The attachment ID.
    3738              * @param int    $parent_id Attachment parent ID.
     3736             * @param string $action        Attach/detach action. Accepts 'attach' or 'detach'.
     3737             * @param int    $attachment_id The attachment ID.
     3738             * @param int    $parent_id     Attachment parent ID.
    37393739             */
    3740             do_action( 'wp_media_attach_action', $action, $att_id, $parent_id );
    3741 
    3742             clean_attachment_cache( $att_id );
     3740            do_action( 'wp_media_attach_action', $action, $attachment_id, $parent_id );
     3741
     3742            clean_attachment_cache( $attachment_id );
    37433743        }
    37443744
  • trunk/tests/phpunit/tests/rest-api/rest-controller.php

    r47911 r47913  
    270270        }
    271271
    272         // ignored properties
     272        // Ignored properties.
    273273        $this->assertArrayNotHasKey( 'ignored_prop', $args['someobject'] );
    274274
     
    276276
    277277    /**
    278      * @dataProvider data_get_fields_for_response,
     278     * @dataProvider data_get_fields_for_response
    279279     */
    280280    public function test_get_fields_for_response( $param, $expected ) {
Note: See TracChangeset for help on using the changeset viewer.