How to deprecate a function in your WordPress plugin or theme properly

If you’re developing a WordPress plugin and fortunately your product is popular enough to improve it regularly, one thing that you would need is to replace a function with a newer version or remove it completely because it has become obsolete or deprecated.

This may be important if the changing function is something the users may use in some ways in their code. For example, a template tag with an outdated prefix like cposter_my_template_tag() is a good candidate. So we’ve decided to update it to something more unique like codeposter_my_template_tag() and we are worried about those users who are using the first version in their products. So what is the solution? Continue reading →

Javascript function declaration or expression?

You may have heard of the different ways of declaring a function in JavaScript. It may seem a bit intimidating to newcomers as they need to learn and consider more, but actually, they aren’t so important except in a few situations.

There are a couple of different examples out there that demonstrate how choosing one can affect your code, but here, we just take a look at an important point to consider which is about placing functions correctly. Continue reading →

A few tips on creating custom tables in WordPress plugins

Although it is recommended to avoid creating custom tables when you make WordPress plugins, however, there are some situations that it is more efficient to create your own custom tables. Fortunately, WordPress provides some great APIs that make our interaction with custom tables much easier. So here I’ve put together a few tips that I think should be considered when you deal with custom tables. Continue reading →

Change the “Featured Image” title in WordPress

Sometimes we need to rename the WordPress “Featured Image” meta box title; And give it a custom name.

Let’s imagine you want to display the companies that you’ve worked with on your website. You created a custom post type to save the companies details. There is a little meta box on the sidebar that allows you upload a logo for each entry. The only ugly thing is its title, “Featured Image”, and we want to change it to “Company Logo”. Continue reading →