3
votes

I have added a php page (test.php) in my root directory (WWW) where wordpress is installed. I don't want to use the custom template method (add this page in my wordpress theme directory) I have added in this php file this:

<?php
require('wp-blog-header.php');
get_header();
?>
<h1>Test</h1>
<?php
get_footer();
?>

When I do: www.example.com/test.php this page is correctly loading but the title of this page display "error 404"

I don't understand how can I resolve this problem.

2
This is bad practice, even for Wordpress. Make a plugin/childtheme etcRonni Skansing

2 Answers

3
votes

you need to include wp-load.php to use header, in your case replace require('wp-blog-header.php'); with

<?php require_once('wp-load.php'); ?>
1
votes

I have placed this code in my root directory in test.php file. This code is working fine if you replace require('wp-blog-header.php'); with require_once('wp-load.php');