Skip to content
WordPress

When creating a plugin for WordPress it’s important to not only keep your files secure, but also discourage direct access to the files from browsers and other remote sources.

This is why it’s important to add a few lines of code to the top of each of your plugin’s files.

if ( ! defined ( 'ABSPATH' ) ) {
        exit;
}

However, due to the simple nature of that code mistakes can happen if you’re handrolling code. For example:

if ( ! defined ( 'abspath' ) ) {
        exit;
}

If you don’t capitalize ‘ABSPATH’ you’ll end up with a blank (displayed AND/OR error logged) issue that you’ll likely spend too much time debugging.
Image of Plugin activation error display

Disclaimer

Purrly Digital LLC cannot be held responsible for the functionality of this code. Please make sure you test it on a development site before adding the code to your production website. There is no support available for this (and other) code snippet(s) posted on this website. If you’d like Purrly Digital to do custom development to help with your custom implementation please send a contact request.

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back To Top