Upgrade to Pro — share decks privately, control downloads, hide ads and more …

From URL to Query (Abridged)

From URL to Query (Abridged)

Presented at WordCamp San Francisco 2014, this is an abridged version of a talk I've given at past WordCamps. For more, see https://ethitter.com/2014/10/from-url-to-query-wcsf-2014/.

"Ever wonder what process WordPress undertakes when someone visits your site? Or how it translates that nice permalink to the database query that ultimately delivers the content your visitors requested? Or what it takes to load the appropriate template from your site’s theme?

In this talk, I’ll walk through WordPress’ loading process and shed some light on the various APIs used. I’ll also discuss how these APIs work together to make the software function."


Erick Hitter

October 25, 2014

More Decks by Erick Hitter

Other Decks in Technology


  1. From URL to Query Erick Hitter @ethitter https://ethitter.com/

  2. STOP 1 index.php

  3. index.php define(  'WP_USE_THEMES',  true  );   ! ! require_once(  …

     '/wp-­‐blog-­‐header.php'  );
  4. STOP 2 wp-blog-header.php

  5. wp-blog-header.php require_once(  …  '/wp-­‐load.php'  );   ! wp();   !

    require_once(  …  '/template-­‐loader.php'  );
  6. wp-blog-header.php Loads the rest of WordPress ! Finds what we’re

    looking for ! Displays it
  7. STOP 3 wp-load.php

  8. wp-load.php Checks for valid wp-­‐config.php 
 Launches the installer

  9. STOP 4 wp-settings.php

  10. wp-settings.php Loads WordPress ! Fires many important actions ! Authenticates

    the user
  11. STOP 5 wp()

  12. wp() Confirms the user ! Determines the query arguments !

    Queries the database
  13. STOP 6 template-loader.php

  14. template-loader.php Loads appropriate theme file according to the Template Hierarchy

  15. Thanks Erick Hitter @ethitter https://ethitter.com/ https://eth.pw/wcsf14