Created
May 11, 2018 09:14
-
-
Save code-flow/b79cc96113f5342df0647b1d280e7901 to your computer and use it in GitHub Desktop.
Rich Snippets WordPress Plugin Global Snippet Permissions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: snip permission configuration | |
| Plugin URL: https://rich-snippets.io/global-snippet-permissions/ | |
| Description: Set correct permission to user roles. | |
| Version: 0.1.0 | |
| Author: wpbuddy | |
| Author URI: https://wp-buddy.com | |
| */ | |
| add_filter( 'wpbuddy/rich_snippets/posttype/global/args', 'snip_perms_posttype_args' ); | |
| function snip_perms_posttype_args( $args ) { | |
| $args['capability_type'] = 'globalsnippet'; | |
| $args['map_meta_cap'] = true; | |
| $args['capabilities'] = array( | |
| // Meta-Capabilities | |
| 'edit_post' => 'edit_globalsnippet', | |
| 'read_post' => 'read_globalsnippet', | |
| 'delete_post' => 'delete_globalsnippet', | |
| // primitive Capabilities | |
| 'edit_posts' => 'edit_globalsnippets', | |
| 'edit_others_posts' => 'edit_others_globalsnippets', | |
| 'publish_posts' => 'publish_globalsnippets', | |
| 'read_private_posts' => 'read_private_globalsnippets', | |
| ); | |
| return $args; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please follow the instructions found here: https://rich-snippets.io/global-snippet-permissions/