title: How to include WordPress functions in custom .php file?
body: <p><strong>How can I include WordPress functions in a custom .php file?</strong></p>
  
  <p>In detail: I have a directory under my theme (Constructor) named reports. These contain .php files that generate reports from data from the site with DOMPDF for downloading. For these I would like to use functions that the WordPress engine provides, for example <code>get_the_author_meta( 'user_firstname', $user_id )</code>. If I use these i get (naturally) the following error:</p>
  
  <blockquote>
    <p>Fatal error: Call to undefined function get_the_author_meta() in ROOT/public_html/wp-content/themes/constructor/reports/testreport.php on line 15</p>
  </blockquote>
  
  <p>I was lead to believe that I need to include wp-blog-header.php . I use <code>require_once("../../../../wp-blog-header.php");</code> . With this I get the following 404 error:</p>
  
  <blockquote>
    <p>No webpage was found for the web address: ROOT/wp-content/themes/constructor/reports/testreport.php</p>
  </blockquote>
  
  <p>(The require points to the correct path. If I fiddle with it, I get Warning: require_once(../../../wp-blog-header.php): failed to open stream... So the path must be correct.)</p>
  
  <p>Is there something I overlook? Why can't I include this wp file? What is the correct method to include the wp functions? </p>
  
  <p>Thanks for the help, Sziro</p>