Cannot change caption for a plugin

You just changed the default value for $top_text. Modifying a plugin directly like that is not a good idea, because the changes will be lost when updating.

There’s quite a bit more code in that plugin, and going through it, I see that there is an options page where that value is set. It seems like you should just change the value of the caption text to <h3>THIS IS NEW CAPTION:</h3> there.

It is possible to alter option values programmatically, so you should be able to add this to your functions.php to alter the value on the fly:

function wpse241711_related_posts_thumbnails_filter_top_text( $top_text ) {
    return '<h3>THIS IS NEW CAPTION:</h3>';
}
add_filter( 'option_relpoststh_top_text', 'wpse241711_related_posts_thumbnails_filter_top_text' );

error code: 523