mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 02:34:38 +00:00
Media: Introduce a filter for wp_get_attachment_image() HTML output.
Props prionkor, antpb, donmhico, audrasjb, Mista-Flo, hellofromTonya. Fixes #50801. git-svn-id: https://develop.svn.wordpress.org/trunk@49234 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1343,6 +1343,24 @@ EOF;
|
||||
$this->assertSame( $expected, wp_get_attachment_image( self::$large_id ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 50801
|
||||
*/
|
||||
function test_wp_get_attachment_image_filter_output() {
|
||||
$image = image_downsize( self::$large_id, 'thumbnail' );
|
||||
$expected = 'Override wp_get_attachment_image';
|
||||
|
||||
add_filter( 'wp_get_attachment_image', array( $this, 'filter_wp_get_attachment_image' ) );
|
||||
$output = wp_get_attachment_image( self::$large_id );
|
||||
remove_filter( 'wp_get_attachment_image', array( $this, 'filter_wp_get_attachment_image' ) );
|
||||
|
||||
$this->assertSame( $expected, $output );
|
||||
}
|
||||
|
||||
function filter_wp_get_attachment_image() {
|
||||
return 'Override wp_get_attachment_image';
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that `wp_get_attachment_image()` returns a proper alt value.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user