Here's my code inside a widget class:
function widget($args, $instance) {
add_action('wp_footer', function () { echo $instance['title'] });
}
It doesn't output $instance['title']
. I tried passing the $instance
parameter in the function, and even tried global $instance;
, but neither worked.
widget
to any hook or invoked it?function update()
andfunction form()
.