From 6496995485cd22b87ec9bd51a543ad8e13fd5102 Mon Sep 17 00:00:00 2001 From: Paul Kang Date: Mon, 27 Oct 2025 13:05:35 -0700 Subject: [PATCH] Fix: Apply WordPress filters to post content, excerpt, and title in get_fb_description() Fixes #1712 Previously, get_fb_description() was directly accessing post properties (->post_content, ->post_excerpt, ->post_title) which bypassed WordPress and third-party plugin filters. This caused issues when plugins used filters like 'the_content', 'the_excerpt', or 'get_the_title' to modify product descriptions, as these modifications were not reflected in the Facebook catalog. Changes: - Replace ->post_content with apply_filters('the_content', ->post_content) - Replace ->post_excerpt with get_the_excerpt() - Replace ->post_title with get_the_title() This ensures that all WordPress filters are properly applied and third-party plugins that modify post content, excerpts, or titles will now work correctly with Facebook product descriptions. Test Plan: 1. Install a plugin that modifies product titles using the 'the_title' filter 2. Create/edit a WooCommerce product 3. Verify the modified title appears in Facebook catalog sync 4. Repeat for plugins modifying content and excerpt --- includes/fbproduct.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/fbproduct.php b/includes/fbproduct.php index 358f9325a..fde9afede 100644 --- a/includes/fbproduct.php +++ b/includes/fbproduct.php @@ -751,9 +751,9 @@ public function get_fb_description() { // If no description is found from meta or variation, get from post if ( empty( $description ) ) { $post = $this->get_post_data(); - $post_content = WC_Facebookcommerce_Utils::clean_string( $post->post_content ); - $post_excerpt = WC_Facebookcommerce_Utils::clean_string( $post->post_excerpt ); - $post_title = WC_Facebookcommerce_Utils::clean_string( $post->post_title ); + $post_content = WC_Facebookcommerce_Utils::clean_string( apply_filters( 'the_content', $post->post_content ) ); + $post_excerpt = WC_Facebookcommerce_Utils::clean_string( get_the_excerpt( $post ) ); + $post_title = WC_Facebookcommerce_Utils::clean_string( get_the_title( $post ) ); // Prioritize content, then excerpt, then title if ( ! empty( $post_content ) ) {