任何不指向实际存在的文件/目录的url都会(通过.htaccess)重定向到index.php 在WordPress安装的根目录中。
index.php 实际加载WordPress及其设置等。然后调用函数wp();, 负责初始化WordPress对请求的实际处理。
wp() 只不过是包装纸而已wp-class class. 特别是main() 方法:
function main($query_args = \'\') {
$this->init();
$this->parse_request($query_args);
$this->send_headers();
$this->query_posts();
$this->handle_404();
$this->register_globals();
do_action_ref_array(\'wp\', array(&$this));
}
The
parse_request() 方法转换请求(处理相当长的永久链接、内部重写和额外参数-
i.e. interpreting ?attachment=1) 进入\'
query_vars\' (与查询有关的变量)。这个
query_posts() 方法,然后将其转换为实际WP_Query 对象(全局$wp_the_query 和$wp_query - 哪些是initialised in wp-settings.php).