Make WordPress Core

Changeset 53845


Ignore:
Timestamp:
08/05/2022 04:10:52 PM (2 years ago)
Author:
adamsilverstein
Message:

Media: remove unused _wp_image_belongs_to_attachment function.

Remove the _wp_image_belongs_to_attachment function which was left over from a an unused branch and added inadvertently as part of r53751.

Props mukesh27.
Fixes #56333.

File:
1 edited

Legend:

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

    r53843 r53845  
    727727}
    728728
    729 
    730 /**
    731  * Checks if an image belongs to an attachment.
    732  *
    733  * @since 6.1.0
    734  * @access private
    735  *
    736  * @param string $filename      Full path to the image file.
    737  * @param int    $attachment_id Attachment ID to check.
    738  * @return bool True if the image belongs to the attachment, false otherwise.
    739  */
    740 function _wp_image_belongs_to_attachment( $filename, $attachment_id ) {
    741     $meta_data = wp_get_attachment_metadata( $attachment_id );
    742 
    743     if ( ! isset( $image_meta['sizes'] ) ) {
    744         return false;
    745     }
    746     $sizes = $image_meta['sizes'];
    747     foreach ( $sizes as $size ) {
    748         if ( $size['file'] === $filename ) {
    749             return true;
    750         }
    751         if ( isset( $size['sources'] ) && is_array( $size['sources'] ) ) {
    752             foreach ( $size['sources'] as $source ) {
    753                 if ( $source['file'] === $filename ) {
    754                     return true;
    755                 }
    756             }
    757         }
    758     }
    759     return false;
    760 }
    761 
    762729/**
    763730 * Generates attachment meta data and create image sub-sizes for images.
Note: See TracChangeset for help on using the changeset viewer.