Created
August 19, 2015 15:29
-
-
Save mattradford/820e2c812941ab6d92e0 to your computer and use it in GitHub Desktop.
Show all registered widgets in wp-admin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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