Use the below example code in your functions.php file to add admin page redirect in your WordPress site.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | /** * Redirect admin pages. * * Redirect specific admin page to another specific admin page. * * @return void * @author Michael Ecklund * */ function disallowed_admin_pages() { global $pagenow; # Check current admin page. if ( $pagenow == 'edit.php' && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'page' ) { wp_redirect( admin_url( '/post-new.php?post_type=page' ) ); exit; } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.