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?


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.

  • what if instead we switched everything to add_theme_support and has_theme_support, but then for backcompat did if(CONSTANT) add_theme_support('bacon')... then the rest of the code will be future proof and that one line can be dropped when enough time has passed? – helgatheviking Jun 17 '12 at 2:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.