Site icon Hip-Hop Website Design and Development

How to get widget content in WordPress based on it’s ID?

I need to parse widget content based on it’s ID.

But a widget works like a function that pulls data based on it’s arguments, right? So when I pull the widget data, I can only get it’s arguments, not the actual output.

How can I parse the widget content based on it’s ID?

Example code:

// Update widget rounds automatically
function automatize_games_rounds($instance, $widget, $args){
    // Check if there is a caption
    if (isset($instance['caption']) && !empty($instance['caption'])) {
        // If there is, does it contain the word "round"?
        if (strpos(strtolower($instance['caption']), 'round')) {
            // If yes, it's the kind of widget I'm looking for. Let's get it's ID.
            $id = $args['widget_id'];
            // Now I need to parse the widget output to do some stuff based on it's content, but how can I get the widget output?
        }
    }
    return $instance;
}
add_filter('widget_display_callback','automatize_games_rounds',10,3);