Prevent Direct Access PHP

When building a plugin, themes or for some security reasons that you might want to prevent direct access to your PHP file you may use the following code:

For WordPress

if( ! defined( 'ABSPATH' ) ) exit;

For Osclass

if( ! defined( 'ABS_PATH' ) ) exit( 'No direct script access allowed' );


This site uses Akismet to reduce spam. Learn how your comment data is processed.