Call to undefined function get_header() in index.php

I am trying to create a theme.

I created a header.php file and call this file in index.php using

Read More
<?php get_header();?>

When I try to run my index.php file it shows this error:

Call to undefined function get_header()

What could be wrong?

Related posts

2 comments

  1. WordPress theme templates are not meant to be executed directly. They are loaded by WordPress core (after appropriate environment had been set up) according to Template Hierarchy.

  2. Generally this happens when someone has mistakenly put index.php from
    a theme in the WP install folder, where it overwrites the index.php
    that is the main WordPress file.
    Download WordPress again, and take the one file, index.php from its
    root folder, replacing the file you now have as index.php

    source

Comments are closed.