Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#22891 closed defect (bug) (invalid)

WordPress Filter media_buttons_context is Not Working in WP Version 3.5

Reported by: onetarek's profile onetarek Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: Editor Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

I am using the filter 'media_buttons_context' to add my custom media button beside the media upload button in the post/page editor.
After updating wordPress to version 3.5 my button is not being shown.

My codes are bellow:

<?php
function wp_myplugin_media_button($context) {
	$wp_myplugin_media_button = ' %s' . '<a href="media-upload.php?type=upload&TB_iframe=true&tab=upload" class="thickbox"><img src="http://onetarek.com/wp-content/uploads/2012/12/shortcode_btn.png" width=15 height=15 /></a>';

	return sprintf($context, $wp_myplugin_media_button);
}

add_action('media_buttons_context', 'wp_myplugin_media_button');
?>

What is the main reason of this problem with wp 3.5?

Change History (3)

#1 @helenyhou
12 years ago

  • Keywords dev-feedback needs-testing removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

media_buttons_context was meant for the text label, not adding buttons. You should be using media_buttons instead. See #22559

#2 @SergeyBiryukov
12 years ago

  • Description modified (diff)

#3 @onetarek
12 years ago

My problem has been solved by using the action 'media_buttons' instead of 'media_buttons_context'
New codes are bellow.

<?php
function wp_myplugin_media_button() {
	echo '<a href="media-upload.php?type=upload&TB_iframe=true&tab=upload" class="thickbox"><img src="http://onetarek.com/wp-content/uploads/2012/12/shortcode_btn.png"  width=15 height=15 /></a>';
}
add_action( 'media_buttons', 'wp_myplugin_media_button',100);
?>

Thanks Helenyhou

Last edited 12 years ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.