0

I have a question about restricting access to page templates for blog editors who may create new pages in the future. During my buildout, I had to create specific templates to add custom features for specific pages (i.e. FAQs pulls from a CPT in a separate loop, but allows the editor to add an intro paragraph using the standard "page" post type)

Now as I hand off the site, I want to make sure that those templates aren't re-used by the site editors as they are constructing new pages. Is there a way to limit the available page templates by user role? Or is it possible to just remove the "Page Template" dropdown completely? I can use Adminimize (http://wordpress.org/plugins/adminimize/) to remove the dropdown, but the label still remains.

Thanks, Devin

  • Good question, but: What have you tried? – kaiser Nov 27 '13 at 19:53
1

Here is a solution to remove that metabox from the edit page - this solution also assumes that the editors don't have access to edit themes.

add_action( 'admin_menu', 'restrict_access' );
function restrict_access() {
if(!current_user_can('edit_themes')){
    remove_meta_box( 'pageparentdiv', 'page','normal' );
    }
}

Hope this helps

0

I think remove_post_type_support can be used for the scope:

add_action('load-post.php', 'no_page_templates');
add_action('load-post-new.php', 'no_page_templates');

function read_only_content() {
  if ( ! current_user_can('manage_options') ) { // change the cap with the wanted one
    $scr = get_current_screen();
    remove_post_type_support( $scr->post_type, 'page-attributes' );
  }
}

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.