Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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