Opened 9 years ago
Closed 9 years ago
#35264 closed enhancement (invalid)
wp_enqueue_script does not allow different types
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.4 |
Component: | Script Loader | Keywords: | |
Focuses: | Cc: |
Description
Dear devs,
I'd like to include a jsonld markup into my blog. I just created a plugin "wp-jsonld" (being reviewed atm).
I am unable to use wp_enqueue_script() and need to use echo instead, because I cannot change the type of the output. wp_enqueue_script() will always assume "text/javascript", where I need to use "application/ld+json".
Other uses (like json+p) might also be of interest.
Best regards,
Ben
Change History (5)
#2
in reply to:
↑ 1
;
follow-up:
↓ 3
@
9 years ago
Replying to swissspidy:
Why do you want to use
wp_enqueue_script()
for this? AFAIK json-Id data needs to be inline, whilewp_enqueue_script()
is specifically for external JavaScript.
I'd love to use some kind of caching. You are right, it needs to be inline. Is it even possible to cache an inline script?
Sorry for opening a ticket, I wasn't aware it needed to be inline.
#3
in reply to:
↑ 2
@
9 years ago
- Milestone Awaiting Review deleted
- Owner set to swissspidy
- Status changed from new to reviewing
Replying to mampf:
Replying to swissspidy:
Why do you want to use
wp_enqueue_script()
for this? AFAIK json-Id data needs to be inline, whilewp_enqueue_script()
is specifically for external JavaScript.
I'd love to use some kind of caching. You are right, it needs to be inline. Is it even possible to cache an inline script?
It's not possible, but since it's just JSON, so you don't really have to worry about client-side caching.
Why do you want to use
wp_enqueue_script()
for this? AFAIK json-Id data needs to be inline, whilewp_enqueue_script()
is specifically for external JavaScript.