How to test a WordPress Dashboard Widget

[ad#Adsense: Horiz 468]

I’m working on a relatively big update to Viddler’s WordPress plugin and something that doesn’t seem to be documented anywhere is how to test a Dashboard Widget if your plugin supports one.

It is fairly easy to add just a bit of code to make it pretty simple to test your widget. First, rather than only loading your WordPress Admin URL (ie. you simply prepend the appropriate information to the end of the URL. Like this:

Then, somewhere within your plugin’s code, you add something like the following:

function viddler_page() {

if ( isset( $_GET['noheader'] ) )

return viddler_dashboard_content();


Obviously viddler_dashboard_content() is the function that I use to build the HTML for the Dashboard Widget. This will return the HTML you’re creating for your WordPress Admin Dashboard Widget sans JavaScript and CSS. But at least you’re able to test your output.