0

I want to write this code on my custom plugin main file to prevent to access folder/files.

define( 'FTEC_DIR', dirname( __FILE__ ) );
  • Could you please provide more information about what you're trying to achieve? Also your question doesn't contain any. – Fabian Marz Dec 7 '16 at 12:14
  • i made a custom plugin but there are one problem when we are put URL of plugin that are show all files and folder so how can i prevent this – Vivek Tamrakar Dec 7 '16 at 12:28
  • Is this is related to web server setting not to allow visiting files in wp-content, wp-admin, wp-include? – prosti Dec 7 '16 at 13:06
  • @prosti So there are not any options/ function to prevent this – Vivek Tamrakar Dec 7 '16 at 13:07
  • @prosti I also check another plugins that are not allow to direct access any files/folder – Vivek Tamrakar Dec 7 '16 at 13:09
0

Well. 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();
}
  • I want to prevent my plugin file and i also want to write code in plugin code file – Vivek Tamrakar Dec 12 '16 at 6:25
  • can you elaborate? – mukto90 Dec 12 '16 at 7:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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