WP Query Console – Quickly Test WordPress Queries

It’s common while working on theme and plugin development, it involves working with WordPress queries. Most common way to test is ‘var_dump( )’ to test the output or refresh the page and see the output but then we thought of creating a handy script long back to make it less boring. Idea was to have something like SQL clients kind of thing so that we can write the query and see the output.

Recently we converted it into a WordPress plugin called “WP Query Console” which is available on plugin directory. You can quickly install it right away from your dashboard. Also, we have published the code on GitHub for other developers to contribute and collaborate.

Once the plugin is installed and activated, new option is added to the main menu “Query Console”. No settings page only one page to input and test your queries. Plugin page provides you with Text editor with code highlight to input your query arguments in the array form and select the type of query you would like to execute from the drop-down (WP_Query, WP_User_Query, WP_Comment_Query, WP_Term_Query, WP_Network_Query, WP_Site_Query). Click on execute to get the query output on the screen. Cool isn’t it?

Under the hood, plugin executes the actual query using the arguments provided against the respective query type and send the output to screen as JSON. You can test queries and validate them before implementing them into your final code.

This plugin might seem silly and pointless but might really help someone. We plan to add more features and improvement by time.

NOTE:

This plugin is meant for development purpose only. To be used on your local / development server.