how to redirect to url.com/wp-admin if url.com/admin is typed in?

Hook into template_redirect, inspect the request URI, and redirect to the return value of admin_url(). add_action( ‘template_redirect’, function() { $request = untrailingslashit( strtolower( $_SERVER[‘REQUEST_URI’] ) ); if ( ‘admin’ === $request ) { wp_redirect( admin_url() ); exit; } }); Note: always use admin_url() and the other built-in URL functions, because they will take care of … Read more

Multisite network admin – URL / redirect error

network admin_url filter can rewrite network admin url. But i don’t know it is a best way or not. // wp-config.php /** Sets up WordPress vars and included files. */ require_once(ABSPATH . ‘wp-settings.php’); // add code // define(‘__WORDPRESS_CORE_DIR__’, ‘/wordpress’); add_filter(‘network_admin_url’, ‘rewrite_my_network_admin_url’, 10, 2); function rewrite_my_network_admin_url($url, $path) { $networkPath = str_replace( ‘/wp-admin/’, __WORDPRESS_CORE_DIR__ . ‘/wp-admin/’, $url … Read more

My wp-admin stops working suddenly

Are you able to see the login screen? When exactly do you get redirected? Try to go to http://yoursite.com/wp-login.php enter your user and password, and see if it works. If it works, the issue could be related to a plug-in.

Custom WordPress Dashboard for Specific user role

Basic implementation: Create a page for the frontend (and optionally a template). Then add the following code to your functions.php: function login_redirect_capability() { if ( current_user_can(‘author’) || current_user_can(‘editor’) ){ return ‘url-of your custom page’; } } add_filter(‘login_redirect’, ‘login_redirect_capability’); This will redirect them to the page you created. If you want to recode the dashboard as … Read more

add_page_menu to make shortcut to widgets

You can add a link to the widgets.php like that: add_action( ‘admin_menu’, ‘f711_add_widgets_shortcut’, 999 ); function f711_add_widgets_shortcut() { add_menu_page( ‘Widgets’, ‘Widgets’, ‘publish_pages’, ‘widgets.php’, ”, ”, 61 ); } Be sure to check your permission settings, and you may also include another image. You can find the documentation about the function at The Codex.