Ready to get started?Download WordPress


Enhanced Header / Footer Injections
Meta Box for Admin Only (1 post)

  1. RevelationTravis
    Posted 1 year ago #

    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?



Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic