From 340a772e739fd422b4e5069e02d51240f7fcf756 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 26 Nov 2012 22:32:35 +0000 Subject: [PATCH] Back compat for media_buttons_context, which is not the correct filter for adding new media buttons. If you want to add additional media buttons, use the media_buttons action instead. fixes #22559. git-svn-id: https://develop.svn.wordpress.org/trunk@22848 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/media.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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' );