in PHP, WordPress

Forcing WP start page

Simple snippet that will replace your WordPress site homepage with page that you want. Put this to your theme’s functions.php

<?php
  add_filter('parse_request', function($wp) {
    if ($wp->request == '') {
      global $wp_query;
      $wp->set_query_var('pagename', 'home');
    }
  });
?>

Write a Comment

Comment