fix: compatibility with WordPress 7.0 and PHP 8.4+#76
Draft
joshuapregua wants to merge 1 commit intodevelopfrom
Draft
fix: compatibility with WordPress 7.0 and PHP 8.4+#76joshuapregua wants to merge 1 commit intodevelopfrom
joshuapregua wants to merge 1 commit intodevelopfrom
Conversation
- Remove deprecated load_plugin_textdomain() path args (WP 6.7 deprecated, WP 7.0 removed) - Remove pass-by-reference on $woocommerce object (fatal on PHP 8.4+) - Replace is_plugin_active() calls with class_exists()/function_exists() (premature timing on after_setup_theme) - Replace removed woocommerce_get_template_part() with wc_get_template_part() - Fix gencwooc_get_template_part() which relied on removed $woocommerce->template_url property (WC 2.1+)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes four deprecations that cause fatal errors or silent failures on WordPress 7.0 and PHP 8.4. No logic, hooks, or user-facing behaviour is changed — deprecation fixes only.
Changes
1. Remove deprecated
load_plugin_textdomain()path argumentsFile:
genesis-connect-woocommerce.phpThe
$deprecatedand$plugin_rel_patharguments were deprecated in WP 6.7 and removed in WP 7.0. WordPress now auto-discovers plugin translations fromwp-content/languages/plugins/.2. Remove pass-by-reference on $woocommerce object (fatal on PHP 8.4)
Using
&on an object is meaningless since PHP 5 (objects are passed by handle). It was deprecated in PHP 8.0 and is fatal in PHP 8.4. Without this fix, WooCommerce'stemplate_loaderis never removed fromtemplate_include, causing double-rendered shop pages on the frontend (/shop/,/product/*,/product-category/*).3. Replace is_plugin_active() with class/function existence checks
4. Replace removed
woocommerce_get_template_part()withwc_get_template_part()woocommerce_get_template_part()was removed in WooCommerce 2.1 (current minimum is 3.3). Also fixesgencwooc_get_template_part()which accessed $woocommerce->template_url — a property also removed in WC 2.1 — making it silently non-functional. Now delegates directly towc_get_template_part().Testing
Environment needed: WordPress 7.0, PHP 8.4, WooCommerce ≥ 3.3, any Genesis child theme.
Enable debug logging in
wp-config.php