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 file via the URL “http://wpsnipp.com/wp-content/themes/themename/functions.php” Great snippet from Pete over at swisswp.

 

 

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

Be Sociable, Share!

Leave a comment