在 WordPress 插件開發中,插件文件中的版本號等註釋應該遵循 WordPress 官方規定的格式,以確保插件能夠正常運行和更新。
具體來說,插件文件中應該包含類似下面這樣的註釋,其中 Plugin Name、Plugin URI、Description、Author、Author URI、Version、License、License URI 是必填字段:
/**
* Plugin Name: My Plugin
* Plugin URI: https://example.com/my-plugin/
* Description: A brief description of the plugin.
* Version: 1.0.0
* Author: John Doe
* Author URI: https://example.com/
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/在這個示例中,Plugin Name 是插件的名稱,Plugin URI 是插件的官方網站地址,Description 是插件的簡短描述,Version 是插件的版本號,Author 是插件的作者名字,Author URI 是作者的網站地址,License 是插件的許可證,License URI 是許可證的網站地址。
請注意,版本號必須使用 x.x.x 的格式,其中 x 是數字,例如 1.0.0。如果你要更新插件,請確保將新版本號寫入插件文件中,並更新插件的版本歷史記錄。這可以幫助用戶知道插件是否需要更新。