Opened 4 years ago
Last modified 4 years ago
#55406 new defect (bug)
Shortcodes don't work inside srcset attribute
| Reported by: | XXVII | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Shortcodes | Version: | 5.8.3 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
Hello,
I have a simple shortcodes which replaces [uploads_directory] with the actual path.
It doesn't work if I put it in a srcset attribute, while it works fine in a src attribute.
<!-- this doesn't work --> <img srcset="[uploads_directory]/2022/03/image.webp 1x, [uploads_directory]/2022/03/image@2x.webp 2x" /> <!-- this is ok --> <img src="[uploads_directory]/2022/03/image.svg" />
This is the code of the shortcode function
<?php function insert_get_uploads_directory() { $directory = wp_upload_dir(); return $directory['baseurl']; } add_shortcode( 'uploads_directory', 'insert_get_uploads_directory' );
Change History (1)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)