Query from MySQL directly

What can be easier than to retrieve any data directly from your WordPress database?

Twig Anything got you covered for this, allowing for endless scenarios – you can retrieve any data about anything and display it the way you want.

Just look at this simple example where we retrieve the total number of autosaved post revisions ever made in your blog:

Query number of autosaves from MySQL

The output it produces is this: 23 – which means there are exactly this number of autosaved revisions in this blog.

See more demos below or read a step-by-step tutorial on retrieving data from your blog’s database and displaying it anywhere in WordPress.

Post modification date

Task: display the latest modification date of a post.

MySQL query:

Twig template:

Output: 2017-11-29 01:42:12

Post status statistics

Task: display a simple counter of draft vs published pages.

MySQL query:

Twig Template:


  • Drafts: 4
  • Published: 18

See a detailed guide on how to fetch about any data from your WordPress database and display it anywhere – in pages and posts, footers and headers, and even widgets.