WP_Widget dynamic field array with external AJAX

I’m not sure I fully understand what you’re trying to achieve, but I’d suggested to attempt to construct the field’s ID and name from data you’ve got available from the source code of the generated widget. If you check out the code, you’ll find that by every widget, there’s a hidden form field called id_base … Read more

Editor Widget Role

This needs to be implemented at the widget code level for which the code in the question you start with is not a good match. The easiest way might be to decouple the widget content editing and the widget placement. You can set up a specific page in which it is possible to manage the … Read more

Cannot access variables within a widget

This is more of a pure PHP than WordPress. You are implicitly creating $ranNum as local variable in function scope. $Example_Widget won’t access widget instance in PHP. What you should be using is $this->ranNum, for reading and writing. That will create object’s property implicitly, but you likely should declare it explicitly in your class definition … Read more

Show widget location borders for development

If your theme is any good, no code at all will be rendered for empty widget areas, so if you want them all to show, you must populate them. There are off course browser tools that will highlight widget areas, but they will only show one at a time, while you presumably want an overview … Read more