Opened 13 years ago
Closed 13 years ago
#4670 closed defect (bug) (no action required)
Duplicate 'ajaxurl' variables
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 1.7 |
Component: | Core | Keywords: | |
Cc: |
Description
As I was looking into #4669, in bp-legacy, the 'ajaxurl'
is outputted in 'bp_head':
https://buddypress.trac.wordpress.org/browser/trunk/bp-templates/bp-legacy/buddypress-functions.php#L95
The problem with that is the 'ajaxurl'
variable is already defined in bp_core_add_ajax_url_js()
.
We could either:
- remove
BP_Legacy::head_scripts()
- remove
bp_core_add_ajax_url_js()
and add a similar 'ajaxurl' function in bp-default's functions.php - rename the head scripts hook in bp-legacy to use 'wp_head' instead of 'bp_head' - would result in duplicate 'ajaxurl' variables being outputted when a theme other than bp-default is enabled
If we are going to stick with having the head_scripts()
method in the BP_Legacy
class, I would rather see it in the parent BP_Theme_Compat
class instead so other theme packs like Turtleshell will not have to define this in their own class unless they want to override it.
There will always be duplicate ajaxurl's the wp_head, as long as there are plugins like BuddyPress, bbPress, Jetpack, etc... installed. Since these are in the global JS scope, and they all point to the same place, I don't see this as a huge deal.
Long term, we should have our own theme-side AJAX handler. See #4449.