ログイン後にユーザーを posts-new.php にリダイレクトする機能を functions.php に追加しました。ただし、ログインしているユーザーが寄稿者である場合にのみ、これを実現したいと考えています。だから私は以下を追加しました:
/** Redirect after login */
function mysite_login_redirect(){
if ( current_user_can( 'manage_options' ) ) {
return 'http://mysite.com/wp-admin/index.php';}
else {
return 'http://mysite.com/wp-admin/post-new.php';}
}
add_action( 'login_redirect', 'mysite_login_redirect');
この状態では、投稿者と管理者の両方が post-new.php にリダイレクトされます。それをテストするために、機能のないユーザーがリダイレクトされるように関数を変更しました。
if ( !current_user_can( 'ma ...
関数を変更すると、貢献者と管理者の両方が index.php にリダイレクトされます。
したがって、機能は機能しているように見えますが、これは、管理者の「manage_options」機能が表示されていないことを意味します。管理者専用の機能をいくつか試しましたが、結果は同じでした。変でしょ?
私は user role-editor-plugin を使用していると言わざるを得ませんが、それを無効にして同じ結果で機能をテストしました。
また、Active Directory Integration と Admin Menu Editor も使用しています。