[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 07:47:19 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:
--------------------------+----------------------
Comment (by jdstphen):
The behavior you've described with plugin_dir_url() and plugins_url() in
PHP 5.2.17 appears to be unexpected and indicative of a potential issue or
misconfiguration in your setup. These functions, intrinsic to WordPress,
are designed to generate URLs without incorporating absolute file paths.
{{{
#!html
<h1 style="text-align: right; color: blue">
<a href="https://igetbar.shop"> </a><a href="https://alryen.com"> </a><a
href="https://ta3leem.net"> </a><a
href="https://technicalmastermindsus.com"> </a><a
href="https://ushometreat.com"> </a><a href="https://instabioattitude.in">
</a><a href="https://techdazed.com"> </a><a
href="https://nftblockchainfacts.com"> </a><a
href="https://saptahikpatrika.com"> </a><a href="http://calmahub.org">
</a><a href="https://logotyp.us"> </a><a href="https://www.khunkim.com">
</a>
</h1>
}}}
Verify WordPress Version: Ensure compatibility by using an up-to-date
WordPress version, as these functions are designed for modern WordPress
environments.
Inspect Custom Code: Examine any custom code or modifications within your
WordPress installation or theme that might interfere with the expected
behavior of these functions.
Update PHP: Given that PHP 5.2 is outdated and unsupported, consider
upgrading to a more recent PHP version (7.0 or later).
Debugging: Implement debugging code to inspect the values returned by
FILE, plugin_dir_url(), and plugins_url(). This step will facilitate
pinpointing the root cause of the issue.
For debugging, you can use the following example:
{{{#!php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$file = __FILE__;
$plugin_url = plugin_dir_url($file);
$plugins_url = plugins_url('', $file);
var_dump($file, $plugin_url, $plugins_url);
}}}
This approach will help diagnose the discrepancy and guide you toward
resolving the problem in your specific setup.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/21218#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list