WP Shout’s article “Using WP_Query Objects Without the Loop” explains it well:
WP_Query
isn’t an abstract entity; rather, it’s an object, in the programming sense. Let’s quickly summarize that discussion:
- Every individual object belongs to a larger class of those objects. For example, an individual Car object belongs to the class Car.
- Every object has things in common with other objects of its class. These commonalities break down into properties and methods.
- Properties are things about a given object. For a Car object, one property might be “color”: “color” itself is the property, and a given Car object might have “red” or “blue” as its value for that property.
- Methods are things a given object can do. A Car object might have
drive()
andstop()
methods.
Any WP_Query
object has a big list of properties and methods. A WP_Query
object’s properties contain all sorts of state and information, which are actually stored in the object itself.