site-kit-wp
site-kit-wp copied to clipboard
Use of WordPress 5.9.0 function in Thank with Google module causing error for older WordPress versions.
Bug Description
In the Thank with Google PHP module code, we are using the wp_get_sidebar
function which was introduced in WordPress 5.9.0.
This is causing the site to be non-functional for pre-5.9.0 when Thank with Google is enabled.
Steps to reproduce
Using a pre-5.9.0 version of WordPress:
- Enable and set up the Thank with Google module.
- Upon refreshing the page the error will be shown as per the screenshot below.
Screenshots
With stack trace displayed via Query Monitor:
Additional Context
- WordPress Version: pre-5.9.0
- PHP Version: any
- OS: any
- Browser: any
- Plugin Version: 1.85.0
- Device: any
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- An alternative to the core
wp_get_sidebar
function should be used which works across all supported versions of WordPress
Implementation Brief
- Add
wp_get_sidebar
into theBC_Functions
compatibility class, copying the implementation from the core source https://developer.wordpress.org/reference/functions/wp_get_sidebar/#source - Update its usage to use the new
BC_Functions::wp_get_sidebar
method
Test Coverage
- No changes needed
QA Brief
- Follow the Steps to reproduce and verify the error no longer occurs.
Changelog entry
- N/A
IB :white_check_mark:
QA Update: ✅
Verified:
- Was able to replicate the issue with an older version of WP prior to 5.9.
- When switched to develop branch the error no longer appears when connecting TwG.
- Switched back to the latest version of WP and ensured that I could still connect TwG with no errors.
https://user-images.githubusercontent.com/73545194/196563760-c8dbdaaa-be2e-4868-ad50-88a5ca9291b0.mp4