[wp-trac] [WordPress Trac] #21134: Registering and enqueueing on the same action can cause enqueueing to happen before registering
WordPress Trac
wp-trac at lists.automattic.com
Mon Jul 2 13:16:32 UTC 2012
#21134: Registering and enqueueing on the same action can cause enqueueing to
happen before registering
--------------------------+------------------------------
Reporter: nbachiyski | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.4
Severity: normal | Resolution:
Keywords: |
--------------------------+------------------------------
Comment (by TobiasBg):
So, if I understand correctly, the problem is that Plugin2 is enqueuing
another plugin's script, without making sure that this other script has
been registered.
(For scripts in WP core, this is not an issue, as those will always have
been registered before.)
So, proper action would have to be taken in Plugin2, either by checking if
the script has been registered, via {{{wp_script_is()}}}, or by making
sure to enqueue after the register has happened, via a higher action hook
priority.
To me, this is what priorities are for, so that documentation issue is not
really valid. And basically, wouldn't this be nearly the same as another
{{{wp_register_scripts}}} action that runs right before
{{{wp_enqueue_scripts}}}?
And: Is this setup really to be found often? Most plugins ship with their
own copy of a script anyway, don't they?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21134#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list