WordPress WP_Query

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:

  1. Every individual object belongs to a larger class of those objects. For example, an individual Car object belongs to the class Car.
  2. Every object has things in common with other objects of its class. These commonalities break down into properties and methods.
  3. 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.
  4. Methods are things a given object can do. A Car object might have drive() and stop() 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.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *