Add a wrapper to your plugin output
if ( $rposts->have_posts() ) {
$html="<div class="pl_recent_posts">";
$html .= '<h3>Recent Posts</h3><ul class="recent-posts">';
while( $rposts->have_posts() ) {
$rposts->the_post();
$html .= sprintf(
'<li><a href="https://wordpress.stackexchange.com/questions/202834/%s" title="https://wordpress.stackexchange.com/questions/202834/%s">%s</a></li>',
get_permalink($rposts->post->ID),
get_the_title(),
get_the_title()
);
}
$html .= '</ul>';
$html .= '</div>';
}
Create a custom CSS file
.pl_recent_posts:not(:first-of-type) h3 {
display: none;
}
And enqueue the CSS file
function pl_recent_posts_styles() {
wp_enqueue_style( 'pl_recent_posts_style', plugins_url('stylesheet.css', __FILE__) );
}
add_action( 'wp_enqueue_scripts', 'pl_recent_posts_styles' );
This doesn’t completely remove it from the DOM but it will hide it from view