Site logo

Archived topic

Disable mobile View

3 replies · Started by Allen on April 23, 2021

Viewing posts 1–4 of 4

Hi there,

that plugin is old - i doubt it works today,

You can try this PHP Snippet to change the sites viewport meta to maintain desktop view:

add_filter( 'generate_meta_viewport', function() {
    return '<meta name="viewport" content="width=1024">';
} );

Thanks David!
It's working well!
How can run this snippet in front page only?
Once visitor clicked on post's title then will go back to normal mobile view?
Thanks

Try this instead:

add_filter( 'generate_meta_viewport', function($meta) {
  $meta = '<meta name="viewport" content="width=device-width, initial-scale=1">';
  if ( is_front_page() && is_home() ) {
    $meta = '<meta name="viewport" content="width=1024">';
  }
  return $meta;
} );
This archived topic is closed to new replies.