img_caption_shortcode
Filter HookDescription
Filters the default caption shortcode output. If the filtered output isn't empty, it will be used instead of generating the default caption template.Hook Information
File Location |
wp-includes/media.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2526 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$output
|
The caption output. Default empty. |
array
|
$attr
|
Attributes of the caption shortcode. |
string
|
$content
|
The image element, possibly wrapped in a hyperlink. |
Usage Examples
Basic Usage
<?php
// Hook into img_caption_shortcode
add_filter('img_caption_shortcode', 'my_custom_filter', 10, 3);
function my_custom_filter($output, $attr, $content) {
// Your custom filtering logic here
return $output;
}
Source Code Context
wp-includes/media.php:2526
- How this hook is used in WordPress core
<?php
2521 *
2522 * @param string $output The caption output. Default empty.
2523 * @param array $attr Attributes of the caption shortcode.
2524 * @param string $content The image element, possibly wrapped in a hyperlink.
2525 */
2526 $output = apply_filters( 'img_caption_shortcode', '', $attr, $content );
2527
2528 if ( ! empty( $output ) ) {
2529 return $output;
2530 }
2531
PHP Documentation
<?php
/**
* Filters the default caption shortcode output.
*
* If the filtered output isn't empty, it will be used instead of generating
* the default caption template.
*
* @since 2.6.0
*
* @see img_caption_shortcode()
*
* @param string $output The caption output. Default empty.
* @param array $attr Attributes of the caption shortcode.
* @param string $content The image element, possibly wrapped in a hyperlink.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/media.php
Related Hooks
Related hooks will be displayed here in future updates.