If you want to set blog page programmatically in WordPress then add that following code in your functions.php file. First you have to make sure that blog page is exists or not. if its no exists then create it. After that add that following code in your functions.php file

$blog   = get_page_by_title( 'Blog' );
update_option( 'page_for_posts', $blog->ID );

Have any doubt, then comment here!

Leave a Reply

Your email address will not be published. Required fields are marked *