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' );

Leave a Reply

Your email address will not be published. Required fields are marked *