I am trying to programmatically set the ‘page_on_front’ option with the id value retrieved from the get_page_by_title command…
$homepage = get_page_by_title( 'Front Page' );
update_option('page_on_front', $homepage);
update_option('show_on_front', 'page');
This isn’t working, can anyone help?
get_page_by_title()
returns an object.Use
$homepage->ID
.You should also check if you really got a usable return value: