3

I'm trying to include some .php files in the header.php of my Wordpress Site.

Here is my schema:

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.

Ferrmolina
  • 2,737
  • 2
  • 30
  • 46

1 Answers1

5

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.

Community
  • 1
  • 1
rnevius
  • 26,578
  • 10
  • 58
  • 86