Snippets

cutiko Programatically set home and blog pages

Created by cutiko

File functions.php Added

  • Ignore whitespace
  • Hide word diff
+<?php 
+$home = get_page_by_title( 'Home' );
+update_option( 'page_on_front', $home->ID );
+update_option( 'show_on_front', 'page' );
+
+$blog   = get_page_by_title( 'Blog' );
+update_option( 'page_for_posts', $blog->ID );
+?>
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.