_cleanup_image_add_caption( array $matches ): string

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Private preg_replace callback used in image_add_caption() .

Parameters

$matchesarrayrequired
Single regex match.

Return

string Cleaned up HTML for caption.

Source

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

Changelog

VersionDescription
3.4.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.