Support » Plugin: Enhanced Header / Footer Injections » Meta Box for Admin Only

  • So I wanted to make the back end meta boxes only available for administrators, so that way Editors (and lower roles) could not inject code into the header and footer. I found a very easy solution for this that I wanted to share with everybody. Open up ehfi-init.php and on line 53, where it says:
    add_action( 'add_meta_boxes', 'nlws_ehfi_add_meta' );
    change it to say:

    if (current_user_can('manage_options')) {
    add_action( 'add_meta_boxes', 'nlws_ehfi_add_meta' );

    The second step, and this is equally important, is to add this line of code to the top of the page (below the plugin notes is fine):
    require_once(ABSPATH . 'wp-includes/pluggable.php');

    And that’s it!

    If the developer is reading this, can that somehow be made as an option in future versions?


  • The topic ‘Meta Box for Admin Only’ is closed to new replies.