WordPress将一些页面跳转到后台

WordPress将一些页面跳转到后台

/**
 * For a recent project we needed to block access to external http requests
 * The about.php and credits.php pages make these requests
 * The easiest way is to simply block access to these pages for all users
 *
 * We have adapted a function we found here:
 * @source: http://natko.com/block-access-to-wp-admin-and-wordpress-dashboard/
 */
function so_redirect_about_credits_pages() {
    $file = basename( $_SERVER['PHP_SELF'] );
    if ( $file == 'about.php' || $file == 'credits.php' && $file != 'admin-ajax.php' ) {
        wp_redirect( admin_url() );
        exit();
    }
}
add_action( 'init', 'so_redirect_about_credits_pages' );

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据