$value ) { $urls[ $key ] = trailingslashit( $base_url ) . wp_basename( $value['file'] ); } } return $urls; } /** * Ensure new search URLs cover known sizes for old attachment. * Falls back to full URL if size not covered (srcset or width/height attributes should compensate). * * @param array $old * @param array $new * * @return array */ function emr_normalize_file_urls( $old, $new ) { $result = array(); if ( empty( $new['guid'] ) ) { return $result; } $guid = $new['guid']; foreach ( $old as $key => $value ) { $result[ $key ] = empty( $new[ $key ] ) ? $guid : $new[ $key ]; } return $result; }