• I am building a plugin.

    I have a text file called version.txt sitting in the plugin folder. Contents of version.txt file is 1.0.1. With php I can read the file no problems.

    Currently inside the functions.php, the version number is hard coded but I wanted to use the contents of the version.txt file to populate it instead, so that rather than hard coding the version into functions.php, I would just update version.txt file.

    /*
    Plugin Name: my plugin name
    Description: version desciption
    Version: $version_number
    Author: me
    Author URI: https://www.mywebsite.com
    Plugin URI: https://www.mywebsite.es
    */

    I have tried all methods of populating version number but wordpress outputs any dynamic code in that section as plain text.

    Any ideas?

    Kindest Regards
    Craig Edmonds

  • The topic ‘How do I replace the plugin version number in functions.php dynamically?’ is closed to new replies.