編集者権限(editor)に特定(作成者が編集者)の固定ページのみを表示する
wordpress 権限 editor 編集者 固定ページ
固定ページ一覧の項目を非表示にする
◆ 補足
views_edit-page
の赤字部分をカスタムポストスラッグに変更可能
function hide_page_links( $views ) {
if(current_user_can('editor')){
unset($views['all']); // すべて
unset($views['draft']); // 下書き
unset($views['publish']); // 公開済み
unset($views['pending']); // 保留中
unset($views['trash']); // ゴミ箱
}
return $views;
}
add_filter('views_edit-page', 'hide_page_links');
クエリを編集
function hide_other_user_posts($wp_query) {
global $current_user;
if(!is_admin()) {
return;
}
if(current_user_can('editor') && get_query_var('post_type') == 'page'){
$wp_query->query_vars['author'] = $current_user->ID;
}
}
add_action('pre_get_posts', 'hide_other_user_posts');