0

Given an URL like the following for wordpress

  1. http://www.mywordpress.com/2014/10/18/
  2. http://www.mywordpress.com

What php files in wordpress is handling the routing?

1 Answer 1

2

The parse_request method in the WP class parses the URL with the rules generated by the WP_Rewrite class. This process converts the request into a set of query variables that the WP class can then use to generate the main query.

6
  • Thanks, but when is the class-wp.php get called? I am interested in what is the first file get called that triggered class-wp.php to handle the path..say calling mywordpress.com, is it the index.php get call first?
    – william007
    Dec 14, 2014 at 4:56
  • index.php requires wp-blog-header.php, which requires wp-load.php then calls wp() function, which kicks off the process. are you just trying to learn how things work, or is there a more specific goal in this question?
    – Milo
    Dec 14, 2014 at 5:11
  • 1
    Thanks! I am interested to learn about how things work, what about mywordpress.com/2014/10/18... this one I am quite puzzling and very interested to know what file does it call first that kicks off the process?
    – william007
    Dec 14, 2014 at 5:17
  • it's the same process for all requests. URLs are matched against rewrite rules, which are patterns that translate parts of the request into query vars, like year, month, day, postname, pagename, taxonomy term, etc.. only the query sent to the database differs for each request, and whatever theme template files go with each type of request according to the template hierarchy.
    – Milo
    Dec 14, 2014 at 5:26
  • 2
    index.php. open that file and follow the includes and you'll see the whole process.
    – Milo
    Dec 14, 2014 at 5:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.