Add content to widget title in admin area within the widget?

Is it possible to add content (icon & text) to widget title in admin area and customizer based on other value from the widget?

Widgets are custom and developed by me (not WP default one)

Ideally it should work bot in admin area & customizer.
On frontend extra content is now shown.


enter image description here


Then user changes an option in the widget and upon the save title changes to

enter image description here


I’ve managed to achieve this with JS and .on('widget-updated widget-added') event, but looking for more robust approach as it doesn’t work in customizer.

3 Answers
3

You can add filter for widget_title hook.

Or change the $instance['title'] on update.

Leave a Comment