Filter hook 'image_add_caption_shortcode'

in WP Core File wp-admin/includes/media.php at line 249

View Source

image_add_caption_shortcode

Filter Hook
Description
Filters the image HTML markup including the caption shortcode.

Hook Information

File Location wp-admin/includes/media.php View on GitHub
Hook Type Filter
Line Number 249

Hook Parameters

Type Name Description
string $shcode The image HTML markup with caption shortcode.
string $html The image HTML markup.

Usage Examples

Basic Usage
<?php
// Hook into image_add_caption_shortcode
add_filter('image_add_caption_shortcode', 'my_custom_filter', 10, 2);

function my_custom_filter($shcode, $html) {
    // Your custom filtering logic here
    return $shcode;
}

Source Code Context

wp-admin/includes/media.php:249 - How this hook is used in WordPress core
<?php
 244  	 * @since 2.6.0
 245  	 *
 246  	 * @param string $shcode The image HTML markup with caption shortcode.
 247  	 * @param string $html   The image HTML markup.
 248  	 */
 249  	return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
 250  }
 251  
 252  /**
 253   * Private preg_replace callback used in image_add_caption().
 254   *

PHP Documentation

<?php
/**
	 * Filters the image HTML markup including the caption shortcode.
	 *
	 * @since 2.6.0
	 *
	 * @param string $shcode The image HTML markup with caption shortcode.
	 * @param string $html   The image HTML markup.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-admin/includes/media.php
Related Hooks

Related hooks will be displayed here in future updates.