1

I've been able to disable all the meta boxes for non admin in their backend but I'm having problems with Facebook AWD All in one which creates a widget seen by all the users when they create new posts. How can I disable it? Is there some sort of command that is good for any widget created by plugins that I can add in my functions.php if I know the shortcode of the plugin? I need your help! Thanks...

http://wordpress.org/extend/plugins/facebook-awd/

I use the following code to remove meta boxes

######################################################################
# remove evreything from add a new post
######################################################################
if (is_admin()) :
function remove_post_meta_boxes() {
 if(!current_user_can('administrator')) {
  remove_meta_box('tagsdiv-post_tag', 'post', 'normal');
//remove_meta_box('categorydiv', 'post', 'normal');
  remove_meta_box('postimagediv', 'post', 'normal');
  remove_meta_box('authordiv', 'post', 'normal');
  remove_meta_box('postexcerpt', 'post', 'normal');
  remove_meta_box('trackbacksdiv', 'post', 'normal');
  remove_meta_box('commentstatusdiv', 'post', 'normal');
  remove_meta_box('postcustom', 'post', 'normal');
  remove_meta_box('commentstatusdiv', 'post', 'normal');
  remove_meta_box('commentsdiv', 'post', 'normal');
  remove_meta_box('revisionsdiv', 'post', 'normal');
  remove_meta_box('authordiv', 'post', 'normal');
  remove_meta_box('slugdiv', 'post', 'normal');
 }
}

add_action( 'admin_menu', 'remove_post_meta_boxes' );
endif;

This is the code of the metabox
Facebook AWD Manager

    <div class="AWD_facebook_wrap">

        <h2>Like Button</h2>
            <div class="alert alert-info">
                <div class="AWD_facebook_likebutton"><div class="fb-like" data-href="http://www.dogsheaven.net/?p=703" data-send="0" data-layout="standard" data-width="250" data-show-faces="0" data-action="like" data-colorscheme="light" data-font="arial" data-ref=""></div></div>
            </div>
        <div class="row">

    <div class="span3">
        <label for="awd_fcbk_option_like_button_redefine">Redefine globals settings ?</label>
        <select id="awd_fcbk_option_like_button_redefine" name="awd_fcbk_option_like_button[redefine]" class="span3" >
        <option value="0" selected="selected" >No</option><option value="1"  >Yes</option>
        </select> 
    </div>

    <div class="span3">
        <label for="awd_fcbk_option_like_button_enabled">Activate ?</label>
        <select id="awd_fcbk_option_like_button_enabled" name="awd_fcbk_option_like_button[enabled]" class="span3" >
        <option value="0"  >No</option><option value="1" selected="selected" >Yes</option>
        </select> 
    </div>

    <div class="span3">
        <label for="awd_fcbk_option_like_button_place">Where ?</label>
        <select id="awd_fcbk_option_like_button_place" name="awd_fcbk_option_like_button[place]" class="span3" >
        <option value="top" selected="selected" >Top</option><option value="bottom"  >Bottom</option><option value="both"  >Both</option>
        </select> 
    </div>
        </div>
    </div></div>

  • Please, add a link to the plugin. Does the shortcode has relation with the meta box? – brasofilo Mar 25 '13 at 16:16
  • Forgot it. Just added... – user27309 Mar 25 '13 at 16:19
  • Can we see the code you are using to turn off widgets? – vancoder Mar 25 '13 at 16:36
  • Just added the code I use to turn off some of the metaboxes – user27309 Mar 25 '13 at 16:44
  • Removed my answer as I didn't read your question properly. Man, that is one eyesore of a plugin. – vancoder Mar 25 '13 at 17:23
2

You can try to add this line to your code example for the admin_menu filter:

remove_meta_box('awd_fcbk_awd_mini_form_metabox', 'post', 'side');

where awd_fcbk is the plugin slug.

Edit:

This is the metabox that I'm targeting from the plugin source code:

//Like button manager on post page type
            add_meta_box($this->plugin_slug . "_awd_mini_form_metabox", __('Facebook AWD Manager', $this->ptd) . ' <img style="vertical-align:middle;" style="vertical-align:middle;" src="' . $this->plugin_url_images . 'facebook-mini.png" alt="facebook logo"/>', array(&$this, 'post_manager_content'), $type, 'side', 'core');
  • 1
    This one gives me the following error Fatal error: Call to undefined function remove_meta_box() in /home/dogsheav/public_html/wp-content/themes/Simpatia/functions.php on line 639 – user27309 Mar 25 '13 at 17:25
  • 2
    Did you place it into the above admin_menu filter code example? – birgire Mar 25 '13 at 17:27
  • That was the problem... – user27309 Mar 25 '13 at 17:31
  • ok great, good luck with your project ;-) – birgire Mar 25 '13 at 17:31
  • 1
    I updated the answer, after I took a look at the plugin source code, so you can see how the metabox is constructed. I removed the 'high' part, since it was a mistake, I meant to have written 'side' ;-) – birgire Mar 25 '13 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.