Get WordPress widget properties outside the widget class

I am very new to WordPress and I need some help with this one.

I have this widget:

Read More
class MyWidget extends WP_Widget { 
       ...
       function widget($args, $instance) {
              ...
       }
}

Then outside the widget class I have a javascript to which I have to pass the widget parameters:

function MyWidget_load_scripts() {
    wp_enqueue_script(
            'my-scripts', plugins_url('assets/js/myscript.js', __FILE__), array('jquery')
    );

    wp_localize_script('my-scripts', 'params', $widgetParameters);
 }

 add_action('wp_enqueue_scripts', 'MyWidget_load_scripts');

How can I get the widget parameters?

Thanks in advance

Related posts

Leave a Reply