WordPress Development Asked on December 15, 2021
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 = "https://mypage.com/wp-admin/index.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.
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP