title: Protecting PHP file from direct access
body: <p>I have been reading some WordPress PHP code on GitHub and I found that the author (a Senior WordPress developer) was putting this line of code in the beginning of each file:</p>
  
  <pre><code>defined('ABSPATH') or die("Cannot access pages directly.");
  </code></pre>
  
  <p>How does this protect the file from direct access?  Can't a hacker just define the constant ABSPATH and then load the file?</p>
  
  <p>Also, why is direct access dangerous?</p>