Stop unauthorised file access
You can use this code on top of your file and apply your role condition if required : if ( ! defined( ‘ABSPATH’ ) ) exit; // Exit if accessed directly For more details follow this link and other one ! Hope this will help. For more details where to use