Custom Post Widget
[resolved] Upload Media Buttons disappared (3 posts)

  1. bgaillard
    Posted 2 years ago #

    Hi, I'm using the Custom Post Widget Plugin and encounted a problem in the Post Edition Page.

    The Button used to add a new content block is shown but the media buttons does not appear now.

    Looking inside the code of your Widget it appears that you are using a deprecated WordPress filter (deprecated since WordPress 3.3) 'media_buttons_context'.

    Since WordPress 3.3 we now have to use the 'media_buttons' filter. So, this is why the media buttons disappeared in my case under WordPress 3.4.1.

    If you want to fix this problem you can replace the 'check_post_type_and_remove_media_buttons' declare in 'post-widget.php' by :

    // Only add content_block icon above posts and pages
    function check_post_type_and_remove_media_buttons() {
    	global $current_screen;
    	if( 'content_block' != $current_screen->post_type ) { 
    		$wordpressVersion = get_bloginfo('version');
    		// See: http://core.trac.wordpress.org/ticket/22891 and http://core.trac.wordpress.org/ticket/22559
    		if(floatval($wordpressVersion) >= 3.3) {
    			add_filter('media_buttons', 'add_content_block_icon' );
    		} else {
    			add_filter('media_buttons_context', 'add_content_block_icon' );

    Hope this helps,



  2. Johan van der Wijk
    Plugin Author

    Posted 2 years ago #

    Hi Baptiste, thank you for your extensive feedback. Strangely the button works normally for me in both wp 3.5.1 and 3.6. It might be that there is a specific issue with version 3.4.1 that you are using.

    In the next release I will use media_buttons filter instead of the deprecated media_buttons_context filter.

  3. digitalisfun
    Posted 2 years ago #

    Baptiste, thanks for the tip - I had a similar conflict with a media plugin and the change worked perfectly for me.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Post Widget
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic