Skip to:
Content

BuddyPress.org

Opened 6 years ago

Closed 6 years ago

#5209 closed defect (bug) (fixed)

enqueue bp_core_confirmation_js

Reported by: bassjobsen Owned by: boonebgorges
Milestone: 2.0 Priority: normal
Severity: normal Version: 1.8.1
Component: Core Keywords:
Cc:

Description

./buddypress/bp-core/bp-core-cssjs.php sets add_action( 'wp_head', bp_core_confirmation_js', 100 ); where bp_core_confirmation_js add javascript to the head which depends on jquery. This code should be enqueued with wp_enqueue_script() to set the jquery dependency. Localization can be add with: wp_localize_script().

Thanks for your attention. I will need this fixes to get WP Defer Loading work with BuddyPress, see: https://github.com/bassjobsen/wp-defer-loading/issues/4

Change History (4)

#1 @boonebgorges
6 years ago

I'm not totally sure why we do it this way (rather than proper enqueuing). I guess the idea is that there are places where we would want the .confirm JS but we don't want to load our entire script library. That makes sense, but in that case why not just have a separate .js file for confirm links? It'll get cached pretty heavily, so I can't imagine a huge performance issue.

Would like an opinion from another dev before moving forward with it.

#2 @bassjobsen
6 years ago

Thanks. Localization has been the reason maybe. wp_localize_script() will solve this

#3 @boonebgorges
6 years ago

  • Milestone changed from Awaiting Review to 2.0

#4 @boonebgorges
6 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 8091:

Move .confirm javascript to a separate, properly enqueued file

This improves our compliance with WP standards, improves our integration with
caching systems, and allows plugins to manage the conditional loading of
scripts.

Fixes #5209

Note: See TracTickets for help on using tickets.