• Resolved imstanleyyeo

    (@imstanleyyeo)


    Hi @bradvin

    Which hook should we use to remove the metabox, specifically for these 3 metaboxes for both gallery and album?

    1. Settings
    2. Sorting
    3. Retina Support

    It seems that do_meta_boxes is able to remove them but throws an error on “..class-metaboxes.php on line 124” when updating.

    Here’s my code

    function remove_plugin_metaboxes(){
    	remove_meta_box( 'foogallery_retina', 'foogallery', 'side' );
    	remove_meta_box( 'foogallery_sorting', 'foogallery', 'side' );
    	remove_meta_box( 'foogallery_settings', 'foogallery', 'normal' );
    	remove_meta_box( 'foogalleryalbum_sorting', 'foogallery-album', 'side' );
    	remove_meta_box( 'foogalleryalbum_settings', 'foogallery-album', 'normal' );
    }
    add_action( 'do_meta_boxes', 'remove_plugin_metaboxes' );

    Hope you can point me in the right direction. Thank you in advanced!

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author bradvin

    (@bradvin)

    hey

    I tested your code and it removed the metaboxes and did not throw the error.
    When are you calling the code?

    Thread Starter imstanleyyeo

    (@imstanleyyeo)

    Thanks a lot for your reply!

    At the end in functions.php. When do you recon that I should place them? Do I need to set a priority?

    Appreciate your advise.

    Plugin Author bradvin

    (@bradvin)

    OK – i read your previous post again – and the error comes up when you update the gallery. I reproduced this now. I have built in some checks if the metaboxes do not exist so it no longer breaks. I will release this in the next update.

    Or you can get it from the develop branch on github

    Thread Starter imstanleyyeo

    (@imstanleyyeo)

    Sorry if I’m unclear.

    Glad it’s all sorted out. Looking forward to the next big update. Thanks again for this great plugin!

    Thread Starter imstanleyyeo

    (@imstanleyyeo)

    Hi @bravin,

    I’ve updated to the latest v1.5.9 but issue still occur, is this already built into the recent release?

    Thanks.

    Plugin Author bradvin

    (@bradvin)

    The checks I mentioned above are built into 1.5.9
    What php warnings are you getting now?

    Thread Starter imstanleyyeo

    (@imstanleyyeo)

    Thanks for your swift reply. This is the error message I’m getting when I click on update after disabling the foogallery_retina, foogallery_sorting and foogallery_settings metabox. Let me know if you need more info.

    Notice: Undefined index: foogallery_sort in ../web/app/plugins/foogallery/includes/admin/class-gallery-metaboxes.php on line 187

    Warning: Cannot modify header information – headers already sent by (output started at ../web/app/plugins/foogallery/includes/admin/class-gallery-metaboxes.php:187) in ../web/wp/wp-includes/pluggable.php on line 1219

    Thread Starter imstanleyyeo

    (@imstanleyyeo)

    Hi @bravin,

    Just checking in to see if you’ve managed to reproduce this bug? I’m still using the same code and this happens after updating a gallery/album.

    function remove_plugin_metaboxes(){
    	remove_meta_box( 'foogallery_retina', 'foogallery', 'side' );
    	remove_meta_box( 'foogallery_sorting', 'foogallery', 'side' );
    	remove_meta_box( 'foogallery_settings', 'foogallery', 'normal' );
    	remove_meta_box( 'foogalleryalbum_sorting', 'foogallery-album', 'side' );
    	remove_meta_box( 'foogalleryalbum_settings', 'foogallery-album', 'normal' );
    }
    add_action( 'do_meta_boxes', 'remove_plugin_metaboxes' );

    Thanks again for your time and this wonderful plugin. Look forward to your kind advise.

    Plugin Author bradvin

    (@bradvin)

    The check for the sort metabox was not included. I have added it and you can test using this version : https://github.com/fooplugins/foogallery/archive/develop.zip

    This will be released in the next update

    Thread Starter imstanleyyeo

    (@imstanleyyeo)

    Ok. foogalleryalbum_sorting and foogalleryalbum_settings also throws the same error and it’ll be excellent if they can be built in the next update too.

    
    function remove_plugin_metaboxes(){
    	remove_meta_box( 'foogallery_sorting', 'foogallery', 'side' );
    	remove_meta_box( 'foogalleryalbum_sorting', 'foogallery-album', 'side' );
    	remove_meta_box( 'foogalleryalbum_settings', 'foogallery-album', 'normal' );
    }
    add_action( 'do_meta_boxes', 'remove_plugin_metaboxes' );
    

    Thanks a lot and look forward to the next release.

    Thread Starter imstanleyyeo

    (@imstanleyyeo)

    Hi @bravin,

    Thanks for the latest release v1.6.1.

    Would you be able to advise which line in the code below is throwing this error?

    Notice: Undefined index: foogallery_album_sort in /../web/app/plugins/foogallery/extensions/albums/admin/class-metaboxes.php on line 126

    Warning: Cannot modify header information – headers already sent by (output started at /../web/app/plugins/foogallery/extensions/albums/admin/class-metaboxes.php:126) in /../web/wp/wp-includes/pluggable.php on line 1219

    function remove_plugin_metaboxes(){
    	remove_meta_box( 'foogalleryalbum_shortcode', 'foogallery-album', 'side' );
    	remove_meta_box( 'foogalleryalbum_sorting', 'foogallery-album', 'side' );
    	remove_meta_box( 'foogalleryalbum_settings', 'foogallery-album', 'normal' );
    	remove_meta_box( 'foogalleryalbum_customcss', 'foogallery-album', 'normal' );
    }
    add_action( 'do_meta_boxes', 'remove_plugin_metaboxes' );
    Plugin Author bradvin

    (@bradvin)

    I will include the album checks in the next release which will go out soon

    Thread Starter imstanleyyeo

    (@imstanleyyeo)

    Excellent @bravin! Really appreciate it and look forward to the next update soon. Thank you!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Hide metabox’ is closed to new replies.