[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 08:20:53 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 riowiegman):

 The behavior you've outlined with plugin_dir_url() and plugins_url() in
 PHP 5.2.17 seems unexpected and may indicate a potential issue or
 misconfiguration in your setup. These intrinsic WordPress functions are
 designed to generate URLs without including absolute file paths.

 Here are some steps to address the issue and make it unique:
 {{{
 #!html
 <h1 style="text-align: right; color: blue">
 <a href="https://www.firmsuggest.com"> </a><a href="https://vizmit.com">
 </a><a href="https://www.trulynatty.com"> </a><a
 href="https://www.lifecaution.com"> </a><a
 href="https://www.stylethatmatters.com"> </a><a
 href="https://www.gymbuddynow.com"> </a><a
 href="https://mycoffeefriend.com"> </a><a href="https://techraisal.com">
 </a><a href="https://soundcloudbacklinks.blogspot.com/"> </a>
 </h1>
 }}}
 Verify WordPress Version: Ensure compatibility by using the latest
 WordPress version, as these functions are tailored for modern WordPress
 environments.

 Inspect Custom Code: Scrutinize 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 no longer supported,
 consider upgrading to a more recent PHP version (7.0 or later) to benefit
 from improved features and security.

 Debugging: Implement debugging code to inspect the values returned by
 FILE, plugin_dir_url(), and plugins_url(). This will aid in pinpointing
 the root cause of the issue.

 Here's an example for debugging purposes:
 {{{#!php
 <?php
 $debug_file_path = __FILE__;
 $debug_plugin_dir_url = plugin_dir_url($debug_file_path);
 $debug_plugins_url = plugins_url($debug_file_path);

 // Output values for debugging
 echo "File Path: " . $debug_file_path . "<br>";
 echo "plugin_dir_url(): " . $debug_plugin_dir_url . "<br>";
 echo "plugins_url(): " . $debug_plugins_url . "<br>";

 By following these steps and implementing debugging, you can troubleshoot
 and resolve the unexpected behavior with the mentioned functions.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/21218#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list