WordPress The Right Way
English en-US
English en-US
  • WordPress The Right Way
  • Getting Started
  • Debugging
    • Error Logging
    • Handling Errors
    • Tools
    • Constants of wp-config.php
  • Data
  • Core
  • Code Style Guide
  • I18n
  • JavaScript
  • Multisite
  • Queries
    • User Queries
    • SQL
    • Taxonomy and Term Queries
    • Comment Queries
    • Post Queries
  • Routing
    • The Main Loop & Template Loading
    • What Are Query Variables and Where Do They Come From?
    • Clashes, Slugs, & Debugging
    • Rewrite Rules
  • Security
    • Secure HTTP
    • Standalone PHP Files
  • Servers And Deployment
    • Migrations
    • WP CLI
  • Templates
  • Testing
    • Testing Theory
      • Test Driven Development
      • Unit Testing
      • Behavior Driven Development
    • Testing Plugins
    • WP_UnitTestCase
  • Widgets
  • Community
  • Credits
Powered by GitBook
On this page
  1. Routing

The Main Loop & Template Loading

  • The main query is a WP_Query object

  • The main loop is using that main query

  • The main query is done before the template is even loaded

  • The template is loaded based on what the main query is

  • The main query is determined by parameters called query variables

  • Which template is loaded when is shown on the template hierarchy diagram

  • All templates are just custom ways of showing the main post loop

PreviousRoutingNextWhat Are Query Variables and Where Do They Come From?

Last updated 4 years ago