shapeshifta
shapeshifta

Reputation: 298

Remove viewport metatag from wordpress?

I looked everywhere but couldn't find a remove action for the viewport metatag from wp_head() in wordpress. Is it possible to remove it?

Found this article http://circlecube.com/2013/01/adding-viewport-meta-tag-via-wordpress-theme-functions/ which helped me to add my own, but now I have two tags...

Does anyone know how to do it?

Upvotes: 3

Views: 4025

Answers (2)

mrwpress
mrwpress

Reputation: 311

Not sure how the accepted answer works. That filter won't work unless wrapped inside of a pre_get_posts action like so:

add_action('pre_get_posts', function() {
    remove_action('wp_head', '_block_template_viewport_meta_tag', 0);
});

The OP did not give the theme they use nor did they say they were using a block theme or not. But if using a block theme then this is the correct anser I believe. Source:

https://core.trac.wordpress.org/ticket/59510

Upvotes: 0

Mithun Sreedharan
Mithun Sreedharan

Reputation: 51274

Comment out the line add_filter('wp_head', 'viewport_meta'); from your themes's functions.php

Upvotes: 3

Related Questions