_cleanup_image_add_caption()WP 3.4.0

Private preg_replace callback used in image_add_caption().

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Return

String. Cleaned up HTML for caption.

Usage

_cleanup_image_add_caption( $matches );
$matches(array) (required)
Single regex match.

Changelog

Since 3.4.0 Introduced.

_cleanup_image_add_caption() code WP 6.5.2

function _cleanup_image_add_caption( $matches ) {
	// Remove any line breaks from inside the tags.
	return preg_replace( '/[\r\n\t]+/', ' ', $matches[0] );
}