WordPress.org

Support

Support » Plugins and Hacks » Custom Post Widget » [Resolved] Upload Media Buttons disappared

[Resolved] Upload Media Buttons disappared

  • 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,

    Baptiste

    http://wordpress.org/extend/plugins/custom-post-widget/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Johan van der Wijk

    @vanderwijk

    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.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Upload Media Buttons disappared’ is closed to new replies.
Skip to toolbar