How to Prevent direct file access to functions.php

Adding this snippet to the functions.php of your wordpress theme will prevent direct file access to the functions.php .

if (!empty($_SERVER['SCRIPT_FILENAME']) && 'functions.php' == basename($_SERVER['SCRIPT_FILENAME']))
{
die ('No access!');
}

Leave a Reply

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