Every WordPress installation ships with an index.php file in the root directory. It is the entry point WordPress uses to load the theme and render your site — without it, your site will not load at all.
If the file is ever missing, corrupted, or accidentally edited, you can restore it with the default content below. This is the exact default index.php that ships with WordPress core.
Default index.php code
Open your WordPress root directory (via cPanel File Manager, FTP or SSH), open index.php, and make sure it contains exactly this:
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';
When do you need this?
- Your site shows a blank white page or a PHP error pointing at index.php.
- The file was accidentally overwritten while editing another file.
- You are restoring a site manually and the root file is missing.
- Malware or a bad plugin modified the file and you want to restore the original.
How to restore it
- Log in to your hosting panel (cPanel / hPanel) and open File Manager.
- Go to the folder where WordPress is installed (usually
public_html). - Find index.php, right-click and choose Edit.
- Replace the entire contents with the default code above and save.
- Reload your website to confirm it loads normally again.
Tip: Never add custom code to index.php. If you need custom PHP, use a child theme’s functions.php or a small custom plugin instead — that way your changes survive WordPress updates.
Warning: Before editing any core file, take a backup of your site. A single missing character can take the whole site offline.
