Typing WordPress Plugin Version Number Only Once

Answered

WordPress requires the plugin version to be in the header comment. I also define it in a class const so that I can access it in code. It seems silly to have to update the version in 2 places though. Is there a way to manage the version number so that there's just one place to update it?

4 comments
Comment actions Permalink

You mean, you'd like to have some kind of a placeholder variable that you could put instead of the version in code, and then modify it's value?
What does the version format look like, is it somewhat unique? Probably you could use Replace in Path for that?

0
Comment actions Permalink

Thanks for the reply. I simply mean that when the version changes, I don't want to update it in more than one place. As it is now, I have to update the header comment as well as my class const.

 

-Steve 

0
Comment actions Permalink

Please answer my second question then, what does the version number look like - if it's unique, you can use Replace in Path for that, just enter the old version number as a find pattern and the new one as a replace pattern.

0
Comment actions Permalink

Yes, it's a pretty standard "1.8.17" format. I'll see how your suggestion works. Thanks.

-Steve

0

Please sign in to leave a comment.