• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

Forwarded to devs "The underscore character is not allowed in the plugin version."

Gromett

New Pleskian
We had this error with our custom plugin. Here is our internal report of the bug and the "fix"

Plesk WordPress Toolkit - Plugin Version Validation Bug Report

Summary


Plesk WordPress Toolkit incorrectly rejects valid WordPress plugins with the error "The underscore character is not allowed in the plugin version." The validation scans the entire plugin file for version strings instead of only checking the plugin header comment block.

Bug Description

Current Behavior:
  • Plesk scans the entire PHP file for the pattern `Version:`
  • When found anywhere in the code (not just the header), it validates the text that follows
  • If a constant name with underscores appears after `Version:`, Plesk rejects the plugin
  • This occurs even when the actual plugin version in the header is valid
Expected Behavior:
  • Version validation should ONLY scan the plugin header comment block (lines 1-20 typically)
  • Code within the plugin should not be subject to version validation
  • Only the `Version:` field in the WordPress plugin header should be validated
Impact

This bug prevents legitimate WordPress plugins from being uploaded when they contain logging or debugging code that references version constants - a common and valid WordPress development practice.

Simple Replication Example

Create a minimal WordPress plugin file named `test-plugin.php`:

<?php
/**
* Plugin Name: Test Plugin
* Description: Demonstrates Plesk validation bug
* Version: 1.0.0
* Author: Test Author
*/

// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}

// Define version constant (standard WordPress practice)
define('TEST_PLUGIN_VERSION', '1.0.0');

// Log initialization with version (triggers Plesk bug)
error_log('Test Plugin starting - Version: ' . TEST_PLUGIN_VERSION);
Result:
- Plugin has valid version `1.0.0` in header
- Plesk rejects upload with error: "The underscore character is not allowed in the plugin version"
- Plesk incorrectly validates `TEST_PLUGIN_VERSION` constant name instead of just the header version

Suggested Fix

Limit version validation to the WordPress plugin header comment block only:
  • Parse only the DocBlock comment at the start of the file.
  • Validate only the `Version:` field within that comment block
  • Ignore any occurrences of "Version:" in the actual PHP code

This aligns with WordPress core's plugin header parsing logic, which only reads the header comment block.

WordPress Standard Reference

WordPress only parses plugin headers from the first 8 KB of the file and only within PHP comment blocks. See: Header Requirements – Plugin Handbook | Developer.WordPress.org

Version constants and version logging are standard WordPress development practices and should not interfere with plugin upload validation.

Workaround

Developers must avoid using the string `"Version: "` anywhere in their code, even in legitimate logging statements. This is an unnecessary restriction that doesn't exist in WordPress itself.

Environment

  • Plesk WordPress Toolkit (current version as of 2025)
  • All WordPress versions
 
Hello, @Gromett . Thank you for the report. We already have a registered bug with ID EXTWPTOOLK-9313 for this issue. I passed the details provided in your report to our team to the internal case. At this point, I cannot provide any ETA on when exactly a fix will be introduced. You can monitor the change log here.
 
Hello, @Gromett . Thank you for the report. We already have a registered bug with ID EXTWPTOOLK-9313 for this issue. I passed the details provided in your report to our team to the internal case. At this point, I cannot provide any ETA on when exactly a fix will be introduced. You can monitor the change log here.
I saw that this was first mentioned in Issue - Plugin code with underscore is not accepted
That was from back in 2022. I posted my bug report as a fresh thread in the hopes it would attract attention and with me providing both the cause and fix I think it may be worth looking at again?
 
Back
Top