How to Find Widget ID in WordPress without a plugin


How to Find Widget ID in WordPress without a plugin

In this tutorial, we are going to see about How to Find Widget ID in WordPress without a plugin Mostly we use View inspect element to find the Widget ID.if we minify the HTML means it’s really annoying to find the Widget ID in WordPress.

Is there any solution to Get the Widget ID in WordPress Admin Dashboard.Yes, You can easily Get the Widget code From your WordPress admin Dashboard.

Just Follow this Steps to Find Widget ID in WordPress without a plugin

  • Copy the Below simple Function code and paste it on your theme Fuctions.php file

add_action('in_widget_form', 'awts_get_widget_id');

function awts_get_widget_id($widget_instance)

{

// Check if the widget is already saved or not.

if ($widget_instance->number=="__i__"){

echo "<p><strong>Widget ID is</strong>: Pls save the widget first!</p>" ;


} else {
echo "<p><strong>Widget ID is: </strong>" .$widget_instance->id. "</p>";


}
}

  • in_widget_form Hook Method
  • Check the Below Image (Demo)

 

Find Widget ID in WordPress

 

  • That’s all Now we can Get the Widget ID in our WordPress Admin Dashboard.

WordPress Plugin – Get Widget ID WordPress Plugin

From the Editor’s Desk

If you Need Any Help related to Find the WordPress Widget ID Please Free to Comment here Our team will Help you.


Was this article helpful?
Thanks!

Your feedback helps us improve Allwebtuts.com



14 Shares
+11
Tweet
Share11
Pin1
Stumble1