Skip to main content
2 of 2
deleted 10 characters in body
henrywright
  • 3.1k
  • 6
  • 39
  • 65

Why is it necessary to prevent direct access to included files?

Why is it necessary to prevent direct access to included files? For example:

if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

I notice many plugins do this but I don't see it in WordPress core files (such as capabilities.php for example).

henrywright
  • 3.1k
  • 6
  • 39
  • 65