admin管理员组文章数量:1333201
Let´s say you are in a creating a page you put the title and the content, the last step is click on "Publish" once you click on publish I want to me redirected to the Dashboard (https://mypage/wp-admin/) of the site where I can see the widgets and the things I can see in the dashboard or other page not to stay in the published page. I found this code but I cant make it work, any Ideas, thank you very much.
add_action( ‘save_post’, ‘redirect_user_page_list’, 10, 3 );
function redirect_user_page_list( $post_ID, $post, $update ) {
if( is_user_logged_in() ) {
$user = wp_get_current_user();
$role = ( array ) $user->roles;
if ( ‘admin’ == $role[0] ) {
$url = ".php";
wp_redirect($url);
exit;
}
}
}
I want to put when the user plublish the post and if the one is administrator.
Thank you very much.
本文标签: Redirect to dashboard user once you click on Publish page
版权声明:本文标题:Redirect to dashboard user once you click on Publish page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742238364a2438491.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论