Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Liltiger on "How To Hide Edit Fields From Non-Admins"

$
0
0

Hey There,

I need to hide some field options in the edit post template.

I've modified this code in wp-admin/edit-form-advanced.php

if ( current_user_can( 'manage_options' ) ) {
        return;
if ( $theme_support || $audio_post_support || $video_post_support )
	add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low');

if ( post_type_supports($post_type, 'excerpt') )
	add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core');

if ( post_type_supports($post_type, 'trackbacks') )
	add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core');

if ( post_type_supports($post_type, 'custom-fields') )
	add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core');
}

It works pefect when an author is editing a post, but it doesn't work for the admin. All I get is this:

"Thank you for creating with WordPress.
Version 3.8.1
This content is currently locked. If you take over, username will be blocked from continuing to edit.
Listings Preview Take over
The backup of this post in your browser is different from the version below. Restore the backup.
Post restored successfully. Undo."

I'm not proficient w/ PHP at all. I can handle snips here and there so any help would be greatly appreciated!


Viewing all articles
Browse latest Browse all 8245

Trending Articles