WordPress disable direct access of files in WordPress installation path

Look into adding a constant check at the top of the script:

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

See: https://stackoverflow.com/questions/43212340/what-is-meant-by-if-defined-abspath