i’m working on updating a theme and previously it had used a lot of php CONSTANTS to set up some options as true or false. we’re going to be updating these “decisions” to use add_theme_support() instead. is it appropriate to use the _deprecated_argument() function to tell child themers that these constants are deprecated? if not, what is the best way to trigger a deprecation warning for a constant?
Leave a Reply
You must be logged in to post a comment.
Unfortunately there is no way to trigger WP deprecation warning for PHP constants.
What I can suggest – to use your constants and “theme support” options together. First for backward compatibility, second for customization facilities. Your theme will have to rely on “theme support” options only, and keep constants only for child theme.
The trick is in the way of declaration such constants. You have to define your PHP constants based on what has been added to support by theme.
After updating your theme, you need to let people know that you don’t use PHP constants any more and you will remove PHP constants in further releases. You can place such information on a site via which you distribute your theme.