Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - View Content events triggering PHP server notices on elementor sites #2501

Conversation

rawdreeg
Copy link
Contributor

Changes proposed in this Pull Request:

Elementor Pro's product-archive template seems to modify the $wp_query global variable. We expect the posts property to be an array of WP_Post objects, but this instead returned as an array of post ids causing the View Content events triggering PHP server notices on elementor sites.

This PR fixes the issue by passing the index value to wc_get_product which can handle both post ids and objects internally.

Closes #2190.

  • Do the changed files pass phpcs checks? Please remove phpcs:ignore comments in changed files and fix any issues, or delete if not practical.

Screenshots:

Detailed test instructions:

  1. Make sure you have elementor core & pro

  2. Create a new template of the type product archive ( The preview is enough to reproduce).
    Screenshot 2023-03-17 at 15 49 01

  3. Click on the preview link and then settings, and configure to only display a given term;
    Screenshot 2023-03-17 at 15 53 55

  4. Apply and preview, then preview. You should see no php warning notices

Additional details:

Changelog entry

Fix - viewContent events triggering PHP server notices on elementor sites

@rawdreeg rawdreeg requested a review from a team March 17, 2023 13:55
@rawdreeg rawdreeg self-assigned this Mar 17, 2023
@github-actions github-actions bot added changelog: fix Took care of something that wasn't working. type: bug The issue is a confirmed bug. labels Mar 17, 2023
Copy link
Contributor

@JPry JPry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏻

@rawdreeg rawdreeg merged commit 317da8d into develop Mar 21, 2023
@rawdreeg rawdreeg deleted the fix/2190-fix-view_content_events_triggering_php_server_notices branch March 21, 2023 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Took care of something that wasn't working. compatibility type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

View Content events triggering PHP server notices
2 participants