if ( !is_multisite() ) { wp_redirect( site_url( ‘/wp-login.php?action=register‘ ) );//将用户重定向到一个预先制定的绝对URI
die(); }$wp_query->is_404 = false; //$wp_query 是在wp-blog-header.php文件中定义的一个WP_Query实体对象,它提供了当前请求的信息。->这个符号访问类实例的属性、方法;
// is_multisite()函数源码,是wordpress自己定义的一个函数function is_multisite() { if ( defined( ‘MULTISITE‘ ) ) return MULTISITE; if ( defined( ‘SUBDOMAIN_INSTALL‘ ) || defined( ‘VHOST‘ ) || defined( ‘SUNRISE‘ ) ) return true; return false; } //函数源码: function wp_redirect($location, $status = 302) {
global $is_IIS; /** * Filter the redirect location. * * @since 2.1.0 * * @param string $location The path to redirect to. * @param int $status Status code to use. */ $location = apply_filters( ‘wp_redirect‘, $location, $status ); /** * Filter the redirect status code. * * @since 2.3.0 * * @param int $status Status code to use. * @param string $location The path to redirect to. */ $status = apply_filters( ‘wp_redirect_status‘, $status, $location ); if ( ! $location ) return false; $location = wp_sanitize_redirect($location); if ( !$is_IIS && php_sapi_name() != ‘cgi-fcgi‘ ) status_header($status); // This causes problems on IIS and some FastCGI setups header("Location: $location", true, $status); return true; }
时间: 2024-10-11 00:24:30