Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#21975 closed enhancement (invalid)

Twenty Twelve: Register navigation.js before enqueue script?

Reported by: mattv's profile MattV Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4.2
Component: Bundled Theme Keywords: 2nd-opinion
Focuses: Cc:


The navigation script in Twenty Twelve theme is not registered before it´s enqueued. If a user wants to replace or remove this script in a child theme, he/she can´t deregister it.

Would it be better to replace line 107 in functions.php:

wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120824', true );

With this?

wp_register_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120824', true );
wp_enqueue_script( 'twentytwelve-navigation' );


Change History (3)

#1 @nacin
10 years ago

As wp_enqueue_script() does registration, calling both one after the other is redundant.

There is both wp_deregister_script() and wp_dequeue_script(), so you can easily remove the handle from the queue or all together. Even if it was registered with "enqueue", dequeueing it keeps it registered.

#2 @MattV
10 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Thanks, I just learnt a few things :)

#3 @SergeyBiryukov
10 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.