Opened 6 months ago
Closed 5 months ago
#4670 closed defect (bug) (invalid)
Duplicate 'ajaxurl' variables
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Core | Version: | 1.7 |
| Severity: | minor | 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.
Change History (1)
comment:1
johnjamesjacoby — 5 months ago
- Milestone 1.7 deleted
- Resolution set to invalid
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.

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.