[wp-trac] [WordPress Trac] #21218: plugin_dir_url and plugins_url display absolute filepath within url
WordPress Trac
noreply at wordpress.org
Wed Jan 3 06:21:55 UTC 2024
#21218: plugin_dir_url and plugins_url display absolute filepath within url
--------------------------+----------------------
Reporter: ChrisWiegman | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: General | Version: 3.4.1
Severity: normal | Resolution: invalid
Keywords: | Focuses:
--------------------------+----------------------
Changes (by riowiegman):
* Attachment "index.html" added.
It seems like you're encountering an issue with the behavior of
plugin_dir_url and plugins_url functions when using PHP 5.2.17 compared to
PHP 5.3.13. In PHP 5.2, these functions include the absolute file path in
the URL string, leading to unexpected results. To address this issue, you
might consider upgrading your PHP version to at least 5.3 or a higher
version, as you've mentioned that the problem is resolved in PHP 5.3. This
is generally a good practice for security and performance reasons, as
newer PHP versions include bug fixes, security patches, and improved
features. If upgrading PHP is not immediately possible or feasible, you
could manually construct the plugin URLs by using constants like
WP_PLUGIN_URL and appending the relative path to your plugin directory.
Here's an example: php Copy code $plugin_url = WP_PLUGIN_URL . '/my-
plugin'; Replace 'my-plugin' with the actual name of your plugin
directory.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/21218>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list