Home › Forums › Pro Support › Remove WPSP For Non Admin Uses
- This topic has 7 replies, 3 voices, and was last updated 4 years, 4 months ago by
Jake.
-
AuthorPosts
-
February 10, 2019 at 6:13 am #7715
Jake
ParticipantHi Tom,
Is there a way to disable WPSP for non-admin users?
Even when using a permissions plugin like: https://wordpress.org/plugins/capability-manager-enhanced/ I can’t see an easy way to disable WPSP for certain permission levels.
Any ideas?
Thank you for your help 🙂
February 11, 2019 at 6:21 pm #7746Tom
KeymasterHi there,
Give this a shot:
add_filter( 'register_post_type_args', function( $args, $post_type ) { if ( 'wp_show_posts' !== $post_type ) { return $args; } $args['capability_type'] = 'manage_options'; return $args; }, 10, 2 );
Adding PHP: https://docs.wpshowposts.com/article/adding-php/
Let me know 🙂
February 12, 2019 at 10:38 pm #7754Jake
ParticipantHey Tom,
I added the code above and can confirm that WPSP is no longer showing for “Authors”.
How exactly is this code working? When will WPSP show/not show – is it only set to show when “Posts” are allowed?
Thanks for the code, and thank you for clarifying 🙂
February 13, 2019 at 4:47 pm #7771Tom
KeymasterThat code makes it so only users with the
manage_options
capability (admins) can see the admin area for Show Posts.Every user role has capabilities, with
manage_options
being one of the ones for admins.February 14, 2019 at 5:28 am #7779Jake
ParticipantArrr that makes sense.
So I could hence enable access to WPSP for say… Editors – by enabling this option https://imgur.com/a/CbmMcLk
Thank you for the code + explanation Tom! 🙂
February 14, 2019 at 6:49 pm #7789Tom
KeymasterYou can change
manage_options
to any one of these: https://codex.wordpress.org/Roles_and_CapabilitiesNo problem! 🙂
July 18, 2019 at 2:54 am #10363Torbjörn
ParticipantAny chance of this becoming standard (or “checkbox configurable” or similar)?
I really don’t want to fiddle with custom PHP if it can be avoided because I can no longer say “look, it’s all out of the box” … and it hides functionality for the next guy that admins the site.WP itself disables stuff that has with structure/building the site to do, for roles like author and editors whom should only be concerned about content. WPSP should, as well.
July 18, 2019 at 3:38 am #10364Jake
ParticipantHey Torbjorn,
I noticed that in the Capability Manager Enhanced plugin now has an option to enable Permissions for WPSP. It’s in the right hand pane of the plugin when you navigate to Users -> Capabilities, as seen here: https://imgur.com/a/5pDoXqc (“Post Lists”).
This enabled you to control WPSPs permissions for your Authors/Editors/etc. just like you would a WordPress page/post – very handy! Pretty much all “Out of the box” now 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.