POST SETTING

Posted in: Newspaper
Post count: 11

I’d like to know how to make these settings visible only to administrators, so authors can’t change them. I’ll post a screenshot to show exactly which options I’m referring to.
https://drive.google.com/file/d/1afHqyPhRqdCiW-Qvhn7pKWz3X3-1mJ0R/view?usp=sharing
Thank you

Post count: 20685

Hi,

The theme panel is available only to admins.

But if you are referring to the post settings from the post edit screen -> https://prnt.sc/LntDAe_ddVEO those will be available for authors, editors, and admins, meaning everyone that can publish posts based on their wordpress user role.

Would you like to hide the post settings from the post edit screen for everyone but admins? I could try to provide a code solution, because it isn’t possible with options. Normally the post settings should be available for users that can publish posts, authors and above.

Let me know.

Thank you!

Post count: 11

Hi,
yes, that’s exactly what I need.

I would like to hide the post settings from the post edit screen for all user roles except administrators.
If it’s not possible through the options panel, a code solution would be great.

Thank you!

Post count: 20685

Then you could try a code like this one:

add_action( 'add_meta_boxes', 'tu_remove_meta_boxes', 999 );
function tu_remove_meta_boxes() {
if ( ! current_user_can( 'manage_options' ) ) {
remove_meta_box( 'td_post_theme_settings_metabox', 'post', 'normal' );
}
}

It can be loaded as a PHP code snippet with a code plugin like this one https://wordpress.org/plugins/insert-headers-and-footers/
Or it can be loaded in a child theme functions file.
It could be loaded in the main theme functions file as well, but this way it will be lost after a theme update and has to be entered again. The more permanent solutions is with a code plugin or child theme.

The code should remove the theme post settings for everyone but admins. You could test it.

Thank you!

Post count: 11

Hi Simion,
great, thank you! I’ve added the code and it’s working correctly.
I’ll continue testing and let you know if anything comes up.

Thanks again for your support!

Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.