最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Redirect to dashboard user once you click on Publish page

programmeradmin7浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论