Skip to content

Instantly share code, notes, and snippets.

@mattradford
Created August 19, 2015 15:29
Show Gist options
  • Save mattradford/820e2c812941ab6d92e0 to your computer and use it in GitHub Desktop.
Save mattradford/820e2c812941ab6d92e0 to your computer and use it in GitHub Desktop.
Show all registered widgets in wp-admin
function show_widget_classes() {
global $wp_registered_widgets;
$widgets = array();
if(is_array($wp_registered_widgets)){
foreach($wp_registered_widgets as $widg){
if(!empty($widg['callback'])){
if(!empty($widg['callback'][0])){
$class = get_class($widg['callback'][0]);
if(!array_key_exists($class, $widgets)){
$widgets[$class] = $widg['callback'][0]->name;
}
}
}
}
}
foreach($widgets as $widget_class => $widget_title ){
echo '<pre>'; print_r( $widget_class ); echo '</pre>';
}
}
add_action( 'admin_notices', 'show_widget_classes' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment