I want to compare the current version of my custom plug-in with update version of plug-in.
I get updated version of plug-in in response from server.
How can I get current version of my plug-in?
I want to compare the current version of my custom plug-in with update version of plug-in.
I get updated version of plug-in in response from server.
How can I get current version of my plug-in?
Comments are closed.
You can use
get_file_data()
function which is available on frontend and backend. For example:if you use
get_plugin_data()
on the frontend it will throw an errorCall to undefined function get_plugin_data()
. Here is the correct way to get plugin header data.You could save you version in the options table for easy retrieval. But you can also use get_plugin_data for more details about a given plugin.
Please note that get_plugin_data is only available in the WordPress admin, it’s not a front-end available function.
For users who land on this question to find out the current version of WordPress itself use this function.