You can use the WordPress conditional tags to accomplish this. Both is_page()
and is_singular()
should work, you just need to pass a slug, or in your case, an ID. Then we can use the wp_head
hook to conditional add in the meta tag.
You can add the following function and hook into your functions.php
file.
/**
* Conditionally add metatag to specific page
*
* @return void
*/
function wpse359922_metatag_conditional() {
if( is_page( 7730 ) ) {
echo '<meta name="viewport" content="width=device-width, initial-scale=0">';
} else {
echo '<meta name="viewport" content="width=device-width, initial-scale=1">';
}
}
add_action( 'wp_head', 'wpse359922_metatag_conditional' );
On a side-note, your whole website should be mobile friendly otherwise it will get dinged on SEO by engines like Google and Bing.