diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index 21b5522768..b776967485 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -391,13 +391,19 @@ function media_buttons($editor_id = 'content') {
'post' => $post
) );
- // $context = apply_filters('media_buttons_context', __('Upload/Insert %s'));
-
$img = ' ';
echo '' . $img . __( 'Add Media' ) . '';
- // echo '' . sprintf( $context, $img ) . '';
+ // Don't use this filter. Want to add a button? Use the media_buttons action.
+ $legacy_filter = apply_filters('media_buttons_context', ''); // deprecated
+
+ if ( $legacy_filter ) {
+ // #WP22559. Close if a plugin started by closing to open their own tag.
+ if ( 0 === stripos( trim( $legacy_filter ), '' ) )
+ $legacy_filter .= '';
+ echo $legacy_filter;
+ }
}
add_action( 'media_buttons', 'media_buttons' );