[wp-trac] [WordPress Trac] #40238: WP REST API post content often relies on inaccessible enqueued JS and CSS
WordPress Trac
noreply at wordpress.org
Wed Mar 22 17:56:49 UTC 2017
#40238: WP REST API post content often relies on inaccessible enqueued JS and CSS
--------------------------+-----------------------------
Reporter: mnelson4 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Often post content has shortcodes in it which rely on JS and CSS in order
to be displayed properly. But when retrieving posts over the WP REST API,
there is no way to get that JS or CSS.
For example, let's say I create a custom shortcode that shows a countdown
timer. In order to do that, when rendering the shortcode, my code enqueues
JS to be outputted in the footer, and returns some HTML placeholder. When
the JS runs in the footer, it converts that HTML placeholder into my sick
countdown timer.
When I retrieve the post via the WP REST API, I only get the rendered post
content, which contains the HTML placeholder, but that's not very useful
without the JS, and there's no way to get that JS file over the WP REST
API, right?
So should the WP REST API somehow expose what JS and CSS is required to
display post content correctly? Or what is to be done with shortcodes
which rely on JS or CSS to be displayed correctly?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40238>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list