• Resolved Cyborg Feelings

    (@amir54)


    I have wrote a function to my themes function.php to hide ALL IN ONE SEO (Meta box) from users, but I want to see this Meta box as Admin.

    This function works sucsessfully to hide the Meta box, but now I can´t see it as Admin.
    Why, what have I done wrong?
    —–

    add_action(‘init’, ‘remove_aioseop’);
    function remove_aioseop() {
    remove_action(‘admin_menu’, ‘aioseop_meta_box_add’);
    }
    if (!current_user_can(‘edit_users’)) {
    add_action(‘admin_menu’, ‘aioseop_meta_box_add’ );
    }

    —–
    (This BOLD part don´t work)

    Thanks for helping

Viewing 1 replies (of 1 total)
  • Thread Starter Cyborg Feelings

    (@amir54)

    I got it WORKING 😀

    I don´t know what was wrong with my previous function. But I modified it and now I can see ALL IN ONE SEO Meta Box as Admin and it´s hidden/removed for Users 🙂

    That worked for me:
    —-

    add_action(‘init’, ‘remove_aioseop’);
    function remove_aioseop() {
    if(!current_user_can(‘administrator’)) {
    remove_action(‘admin_menu’, ‘aioseop_meta_box_add’);
    }
    }

    —-

Viewing 1 replies (of 1 total)
  • The topic ‘How to hide meta_box for users (Not from Admin)?’ is closed to new replies.