G
G
Grisha Nikolsky2015-11-19 21:55:18
WordPress
Grisha Nikolsky, 2015-11-19 21:55:18

How can you understand this line of code?

I came across the following piece of code while parsing the plugin:

if ( ! defined( 'WPINC' ) ) {
    die;
}

Googled it. Information about defined is:
defined — Tests for the existence of the specified named constant

The author writes about it as follows:
Note the conditional statement at the bottom of the file. This means that the plugin file will not be directly accessible in a web browser.

But what is WPINC I can’t understand or find in any way.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita, 2015-11-19
@VoxelGod

WPINC
The name of the wp-includes directory. You cannot change this constant.
Default: wp-includes

N
nozzy, 2015-11-20
@nozzy

This is a normal check.
Therefore, this page cannot be accessed directly - by url, it can only be accessed from the php code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question