Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.
if ( ! function_exists( 'wp' ) && ! empty( $_SERVER['SCRIPT_FILENAME'] ) && basename( __FILE__ ) == basename( $_SERVER['SCRIPT_FILENAME'] ) ) {
    die ( 'You do not have sufficient permissions to access this page!' );
}

I find these lines of code in index.php of a theme in WordPress.
What is the logic behind these lines?

share|improve this question

1 Answer 1

Basically Its a check if the index.php file is accessed directly and not by WordPress, if the first is the case then the scripts stops the execution , displays a message

You do not have sufficient permissions to access this page!

And stops farther execution for the script.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.