How to handle error messages in PHP

Error messages are nightmares to a programmer. Default error messages are annoying and looking ugly. And kind of security threat as well. You probably wish to show a custom message when an error occurred. And tried and failed? I had written this small code snippet for one of my projects and now wondering if this…

Generate activation or deactivation link of WordPress plugin

You often need an action link to activate or deactivate a plugin. How do you do that? I have written a simple function that can help you achieve this. How to generate plugin activation or deactivation link PHP <?php /** * Get activation or deactivation link of a plugin * * @author Nazmul Ahsan <mail@nazmulahsan.me>…

Edit Next Post – my 16th plugin published in WP repository

As I’m a man of Open Source, I always try to give back to the community. I already had 15 plugins published in WordPress repository. And today, the 16th one just added in the list. Of course free and Open Source. Edit Next Post, the plugin you’ll always need Imagine when you have a lot…

Add a ‘Scroll to Top’ button to your WordPress site

A ‘Scroll to Top’ button can enhance usability of your website. There are several plugins available out there that can help you achieve this. You just need to install the plugin and activate it. Few days back, I’ve written a plugin that adds this feature to a WP site. Unlike other similar plugins, this one…

A simple two-way function to encrypt or decrypt a string

This function will provide you a two-way system to encrypt a string or decrypt an encrypted string. Function PHP /** * Encrypt and decrypt * * @author Nazmul Ahsan <n.mukto@gmail.com> * @link http://nazmulahsan.me/simple-two-way-function-encrypt-decrypt-string/ * * @param string $string string to be encrypted/decrypted * @param string $action what to do with this? e for encrypt, d…

Change WordPress password when ‘reset password’ is not working

Imagine a situation when you forgot the password of your admin account of your WordPress site, and ‘reset password’ is not functioning. Or even, you cannot remember the email you used for it. You cannot access the wp-admin area. Now what? Well, there’s a solution. You can change the password from phpMyAdmin without knowing previous…

How to stop WordPress from generating multiple image sizes

When you upload an image using the media uploader of your WordPress site, it creates multiple sizes of that image. By default, WordPress creates 4 additional sizes, but your theme and/or plugin(s) may create more sizes of that image. And it’s really a headache when you are considering your storage. So, how to stop it?…

How to remove default widgets (aka meta boxes) from WordPress dashboard

Remove default widgets from WordPress dashboard WordPress comes with some default widgets, i.e Activity, Quick Draft, WordPress News etc. Sometimes you may feel disgusted to see them on dashboard and wish to remove unnecessary widgets. There are a lot of plugins that can help you clean you dashboard. And you can do the same with…