Last active
April 12, 2017 13:47
-
-
Save EricBusch/8090711804382333e66e to your computer and use it in GitHub Desktop.
Display widget ID for each widget on the Widgets admin page. [wordpress]
This file contains 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
<?php | |
/** | |
* Display widget ID on Widgets page. | |
* | |
* Use this to see the IDs of all of your widgets here: | |
* WordPress Admin Area > Appearance > Widgets | |
* | |
* To disable, simply comment out the add_filter() function. | |
* | |
* @param array $params Information about this widget. | |
* @return array The updated $params array. | |
*/ | |
add_filter( 'dynamic_sidebar_params', 'mycode_dynamic_sidebar_params' ); | |
function mycode_dynamic_sidebar_params( $params ) { | |
$params[0]['widget_name'] = '(' . $params[0]['widget_id'] . ') ' . $params[0]['widget_name']; | |
return $params; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment