[wp-hackers] Loading scripts in WordPress

Chip Bennett chip at chipbennett.net
Tue Dec 10 20:22:28 UTC 2013


Shortcodes are parsed at the the_content filter.

That said: you can simply call wp_enqueue_script() inside your shortcode
callback, which will ensure that your scripts only get enqueued when the
shortcode is parsed.


On Tue, Dec 10, 2013 at 3:20 PM, Dave Navarro <dave at topekadesign.com> wrote:

> At what point does WordPress process short codes in content?
>
> I have a short-code I created for displaying a custom Google map and I
> only want to load the necessary javascript files if the short-code is used
> on a page.  Are short-codes processed before the headers are sent to the
> browser or after?
>
> Thanks!
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list