
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?
In this case, we should somehow inform the users that the mentioned function is a Deprecated one, and will be removed in next major release and users most avoid using it anymore to be safe for the future updates. It is usually done by showing a warning to anyone using the method or function.
A good example for such situations is WordPress itself. WordPress has a file where it keeps the deprecated functions for backward compatibility. You can find a couple of deprecated ones there:
wp-includes/deprecated.php
1234567891011121314151617181920212223242526
Source: https://managewp.org/articles/14794/how-to-deprecate-a-function-in-your-wordpress-plugin-or-theme-properly
source https://williechiu40.wordpress.com/2017/04/06/how-to-deprecate-a-function-in-your-wordpress-plugin-or-theme-properly/
No comments:
Post a Comment