add_action('post_grid_media', 'post_grid_media_20200614', 10, 2); function post_grid_media_20200614($post_id, $args){ $source_id = $args['source_id'] ; $source_args = $args['source_args'] ; if($source_id == 'something'){ ?> <div class="">Custom media HTML</div> <?php } }