Opened 10 years ago
Last modified 7 years ago
#39414 new enhancement
New param in plugin_dir_path
| Reported by: | sebastian.pisula | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Plugins | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
New param - path. Function with this param return full path to file. Examples:
<?php var_dump(plugin_dir_path(__FILE__)); var_dump(plugin_dir_path(__FILE__, 'assets/test.png'));
string(26) "\wp-content\plugins\myplugin/" string(41) "\wp-content\plugins\myplugin/assets/test.png"
Attachments (1)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
What is the advantage of
plugin_dir_path( __FILE__ , 'assets/test.png' )over simply usingplugin_dir_path( __FILE__ ) . 'assets/test.png' )? I don't really see a benefit of using a second param for that when you can simply concatenate the strings on your own. Developers would probably not use it because of back compat. Also,plugin_dir_path()says it returns the path to a directory, not a file.