WordPress – Include_once root files

I’m trying to include some .php files in the header.php of my WordPress Site.

Here is my schema:

Read More
Root/
    |_ includes
        |_ db_connect.php
        |_ functions.php
        |_ var_list.php
    |_ wp-includes
    |_ wp-content
        |_ themes
            |_ NameTheme
                |_ header.php
    |_ wp-admin

I need to include this lines on my header.php

include_once 'includes/db_connect.php';
include_once 'includes/functions.php';
include_once 'includes/var_list.php';

sec_session_start(); // function to start session, placed in functions.php

What I tryed:

  1. With $_SERVER['DOCUMENT_ROOT']
  2. With dirname(_FILE_)
  3. With ABSPATH // this are define on my wp-config.php
  4. With home_url
  5. With site_url

All return blank page (500 internal error)
Can help me, please?
Thanks.

Related posts

1 comment

  1. If you have a standard wp-config.php file, ABSPATH should be defined. This means you should be able to use:

    include_once(ABSPATH . 'includes/db_connect.php');
    

    Read more in this related answer.

Comments are closed.