when the incoming url is a query, in which function does WP begin to work with it?

I need to debug a problem with filters I have in place. they're affecting any url that includes a query; eg, http://my.domain.hk/?attachment=1. does anyone know in which function WP begins to work with this kind of url, one that includes a query?

cheers,
Gregory

Topic wp-parse-args query-string Wordpress

Category Web


Any url that doesn't point to a file/directory that actually exists is redirected (by .htaccess) to the index.php in the root of your WordPress install.

index.php is what actually loads WordPress and its settings etc. It then calls the function wp();, which is responsible for initialising WordPress' actually handling of the request.

wp() is little more than a wrapper for the wp-class class. In particular, the main() method:

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() method turns the request (handling pretty permalinks, internal rewrites and extra arguments -i.e. interpreting ?attachment=1) into 'query_vars' (variables concerning the query). The query_posts() method then turns that into an actual WP_Query object (the globals $wp_the_query and $wp_query - which are initialised in wp-settings.php).

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.