I want to write this code on my custom plugin main file to prevent to access folder/files.
define( 'FTEC_DIR', dirname( __FILE__ ) );
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityWell. If I'm not wrong, you are looking for a way to hide what files are in your plugin directory?
Just keep an index.php
file in your plugin directory.
And as an extra layer of security, add this code at the very beginning of all of your PHP files-
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die();
}
wp-content
,wp-admin
,wp-include
?