embed_thumbnail_image_shape
Filter HookDescription
Filters the thumbnail shape for use in the embed template. Rectangular images are shown above the title while square images are shown next to the content.Hook Information
| File Location |
wp-includes/theme-compat/embed-content.php
View on GitHub
|
| Hook Type | Filter |
| Line Number | 75 |
Hook Parameters
| Type | Name | Description |
|---|---|---|
string
|
$shape
|
Thumbnail image shape. Either 'rectangular' or 'square'. |
int
|
$thumbnail_id
|
Attachment ID. |
Usage Examples
Basic Usage
<?php
// Hook into embed_thumbnail_image_shape
add_filter('embed_thumbnail_image_shape', 'my_custom_filter', 10, 2);
function my_custom_filter($shape, $thumbnail_id) {
// Your custom filtering logic here
return $shape;
}
Source Code Context
wp-includes/theme-compat/embed-content.php:75
- How this hook is used in WordPress core
<?php
70 * @since 4.5.0 Added `$thumbnail_id` parameter.
71 *
72 * @param string $shape Thumbnail image shape. Either 'rectangular' or 'square'.
73 * @param int $thumbnail_id Attachment ID.
74 */
75 $shape = apply_filters( 'embed_thumbnail_image_shape', $shape, $thumbnail_id );
76 }
77
78 if ( $thumbnail_id && 'rectangular' === $shape ) :
79 ?>
80 <div class="wp-embed-featured-image rectangular">
PHP Documentation
<?php
/**
* Filters the thumbnail shape for use in the embed template.
*
* Rectangular images are shown above the title while square images
* are shown next to the content.
*
* @since 4.4.0
* @since 4.5.0 Added `$thumbnail_id` parameter.
*
* @param string $shape Thumbnail image shape. Either 'rectangular' or 'square'.
* @param int $thumbnail_id Attachment ID.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/theme-compat/embed-content.php
Related Hooks
Related hooks will be displayed here in future updates.