Plugin namespace

Creating a plugin inside a namespace By using a namespace, everything inside the namespace does not need globally unique naming prefixes, solving clashing issues with other plugins, themes and wordpress itself. Using a namespace is much simpler than using a class for your plugin. Add all your php files to the namespace Add this to […]

Read More

Plugin class

Creating a plugin inside a class By using a class, everything inside the class does not need globally unique naming prefixes, solving clashing issues with other plugins, themes and wordpress itself. BUT, in PHP a class has to be contained in a single file, you can’t split a class across multiple files. You can create […]

Read More

.Create New Plugin

The basics Decide on a name for your plugin, this must be globally unique. Create a folder in the wp-content/plugins/ directory using your plugin name.Use lowercase and replace any spaces with hyphens. Create a file in the folder with the exact same name as your plugin folder, with the “.php” extension.This is the master file […]

Read More

Converting Form Text Fields

Sanitising for HTML from a form POST If server magic quotes is turned on then it will add / before a single and double quotes in the text, so strip them out first: \n new line characters will still be stored as \n (htmlspecialchars() doens’t convert them to <be>). You can convert them now using […]

Read More

File Upload Troubleshooting

Check: Make sure your <form> tag has the enctype=”multipart/form-data” attribute Check php.ini for: file_uploads = On, post_max_size = 100M, upload_max_filesize = 100M (Note it’s “M”, not “MB”)You might need to use .htaccess or .user.ini if you are on shared hosting and don’t have access to php.ini.

Read More