Удалить страницу медиафайла Вордпресс

add_action('template_redirect', 'bez_stranic_vlogenii');
function bez_stranic_vlogenii() {
	global $wp_query, $post;
	if ( is_attachment() ) :
		$wp_query->set_404();
	endif;
}

в functions.php темы и будет тебе счастье без дополнительных плагинов:

add_action( 'template_redirect', function(){
  if ( is_attachment() ) {
    global $post;
    if ( !empty($post->post_parent) ) {
      wp_redirect( esc_url( get_permalink( $post->post_parent ) ), 301 );
    } 
    wp_redirect( esc_url( home_url( '/' ) ), 301 );
  }
});