Filter: RCB/Experimental/OptimizedWpLocalizeScript

apply_filters( 'RCB/Experimental/OptimizedWpLocalizeScript', $useOptimizedWpLocalizeScript ) → {boolean}

If you return true, the optimized wp_localize_script will be used:

  • Moves the JSON to the footer but keeps the banner script in the header
  • Bypasses the JSON.parse call from the HTML parsing process and just exposes the raw JSON string in the inline script in the HTML
  • This improves performance as the JSON parsing is offloaded to a deferred script
Parameters:
Name Type Description
$useOptimizedWpLocalizeScript boolean
Since:
  • 5.2.10
Returns:
Type
boolean