Skip to content

Instantly share code, notes, and snippets.

@code-flow
Created May 11, 2018 09:14
Show Gist options
  • Select an option

  • Save code-flow/b79cc96113f5342df0647b1d280e7901 to your computer and use it in GitHub Desktop.

Select an option

Save code-flow/b79cc96113f5342df0647b1d280e7901 to your computer and use it in GitHub Desktop.
Rich Snippets WordPress Plugin Global Snippet Permissions
<?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;
}
@code-flow

Copy link
Copy Markdown
Author

Please follow the instructions found here: https://rich-snippets.io/global-snippet-permissions/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment