Skip to:
Content

#4670 closed defect (bug) (invalid)

Duplicate 'ajaxurl' variables

Reported by: r-a-y 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:

  1. remove BP_Legacy::head_scripts()
  2. remove bp_core_add_ajax_url_js() and add a similar 'ajaxurl' function in bp-default's functions.php
  3. 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 johnjamesjacoby16 months ago

  • Milestone 1.7 deleted
  • Resolution set to invalid
  • Status changed from new to closed

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.

Note: See TracTickets for help on using tickets.