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

You may also like...