Give administrator single post capabilities
This commit is contained in:
@@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
function sportspress_admin_init() {
|
function sportspress_admin_init() {
|
||||||
$post_types = array(
|
$post_types = array(
|
||||||
'sp_events',
|
'sp_event',
|
||||||
'sp_calendars',
|
'sp_team',
|
||||||
'sp_teams',
|
'sp_table',
|
||||||
'sp_tables',
|
'sp_player',
|
||||||
'sp_players',
|
'sp_list',
|
||||||
'sp_lists',
|
'sp_staff',
|
||||||
'sp_staffs',
|
'sp_config',
|
||||||
'sp_configs',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$caps = array(
|
$caps = array(
|
||||||
'publish',
|
'publish',
|
||||||
|
'read',
|
||||||
'delete',
|
'delete',
|
||||||
'delete_others',
|
'delete_others',
|
||||||
'delete_private',
|
'delete_private',
|
||||||
@@ -28,8 +28,9 @@ function sportspress_admin_init() {
|
|||||||
$administrator = get_role( 'administrator' );
|
$administrator = get_role( 'administrator' );
|
||||||
|
|
||||||
foreach( $post_types as $post_type ):
|
foreach( $post_types as $post_type ):
|
||||||
|
$administrator->add_cap( 'edit_' . $post_type );
|
||||||
foreach ( $caps as $cap ):
|
foreach ( $caps as $cap ):
|
||||||
$administrator->add_cap( $cap . '_' . $post_type );
|
$administrator->add_cap( $cap . '_' . $post_type . 's' );
|
||||||
endforeach;
|
endforeach;
|
||||||
endforeach;
|
endforeach;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user