#2799 closed defect (bug) (fixed)
Cache 'dynamic' Javascript
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 2.1 | Priority: | normal |
| Severity: | normal | Version: | 2.1 |
| Component: | Administration | Keywords: | has-patch 2nd-opinion |
| Focuses: | Cc: |
Description
The PHP generated Javascript files are not being cached properly.
Attached:
- Call wp-config.php instead of admin.php to avoid cache blocking and unnecessary overhead.
- Send Cache-control: max-age=2600000, must-revalidate
These scripts only need the PHP for i18n (if that), so the ~1 month long freshness period shouldn't hurt.
Attachments (2)
Change History (6)
#2
@
19 years ago
Well if you'd like to be clever about it, sure :)
2799b.diff
- wp-includes/js/js-headers.php gets the include right and sends the headers.
This ticket was mentioned in Slack in #core-editor by iseulde. View the logs.
8 years ago
Note: See
TracTickets for help on using
tickets.
require_once('../wp-config.php'); header('Content-type: text/javascript; charset=' . get_settings('blog_charset'), true); header('Cache-control: max-age=2600000, must-revalidate', true); // ~1 monthI see those three lines listed three times, and there will probably be other times as we add more JS functionality in the future. Wanna move that to an include so that there's one place to go to edit it all?