Changeset 56651
- Timestamp:
- 09/21/2023 04:35:30 PM (10 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r56612 r56651 5626 5626 global $wp_query; 5627 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5628 5647 $loading_attrs = array(); 5629 5648 … … 5633 5652 */ 5634 5653 if ( 'template' === $context ) { 5635 return $loading_attrs; 5654 /** This filter is documented in wp-includes/media.php */ 5655 return apply_filters( 'wp_get_loading_optimization_attributes', $loading_attrs, $tag_name, $attr, $context ); 5636 5656 } 5637 5657 5638 5658 // For now this function only supports images and iframes. 5639 5659 if ( 'img' !== $tag_name && 'iframe' !== $tag_name ) { 5640 return $loading_attrs; 5660 /** This filter is documented in wp-includes/media.php */ 5661 return apply_filters( 'wp_get_loading_optimization_attributes', $loading_attrs, $tag_name, $attr, $context ); 5641 5662 } 5642 5663 5643 5664 // For any resources, width and height must be provided, to avoid layout shifts. 5644 5665 if ( ! isset( $attr['width'], $attr['height'] ) ) { 5645 return $loading_attrs; 5666 /** This filter is documented in wp-includes/media.php */ 5667 return apply_filters( 'wp_get_loading_optimization_attributes', $loading_attrs, $tag_name, $attr, $context ); 5646 5668 } 5647 5669 … … 5655 5677 // TODO: Handle shortcode images together with the content (see https://core.trac.wordpress.org/ticket/58853). 5656 5678 if ( 'the_content' !== $context && 'do_shortcode' !== $context && doing_filter( 'the_content' ) ) { 5657 return $loading_attrs; 5679 /** This filter is documented in wp-includes/media.php */ 5680 return apply_filters( 'wp_get_loading_optimization_attributes', $loading_attrs, $tag_name, $attr, $context ); 5658 5681 } 5659 5682 … … 5790 5813 } 5791 5814 5792 return $loading_attrs; 5815 /** 5816 * Filters the loading optimization attributes. 5817 * 5818 * @since 6.4.0 5819 * 5820 * @param array $loading_attrs The loading optimization attributes. 5821 * @param string $tag_name The tag name. 5822 * @param array $attr Array of the attributes for the tag. 5823 * @param string $context Context for the element for which the loading optimization attribute is requested. 5824 */ 5825 return apply_filters( 'wp_get_loading_optimization_attributes', $loading_attrs, $tag_name, $attr, $context ); 5793 5826 } 5794 5827 -
trunk/tests/phpunit/tests/media.php
r56616 r56651 5442 5442 5443 5443 /** 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5444 5547 * Helper method to keep track of the last context returned by the 'wp_get_attachment_image_context' filter. 5445 5548 *
Note: See TracChangeset
for help on using the changeset viewer.