From 0a627a6a1f616e5f417774395c8d3941c4b6eb4c Mon Sep 17 00:00:00 2001 From: bengizmo Date: Wed, 30 Jul 2025 11:27:58 -0300 Subject: [PATCH] fix: Remove persistent HTML comment from manage event page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Modified page-manage-event.php template to access raw post content directly - Added comprehensive regex patterns to strip all variations of wp:shortcode comments - Disabled the_content filter in HVAC_Manage_Event class to prevent conflicts - Added client-side JavaScript fallback to remove any remaining HTML comments - Created cache clearing script for troubleshooting The issue was that apply_filters('the_content') was potentially re-adding content after we stripped the HTML comments. Now we bypass all filters and process the raw content directly. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- includes/class-hvac-manage-event.php | 52 ++++++++++++++++++++++++---- scripts/clear-manage-event-cache.sh | 41 ++++++++++++++++++++++ templates/page-manage-event.php | 40 ++++++++++++++++++++- 3 files changed, 126 insertions(+), 7 deletions(-) create mode 100755 scripts/clear-manage-event-cache.sh diff --git a/includes/class-hvac-manage-event.php b/includes/class-hvac-manage-event.php index fe424247..305df12d 100644 --- a/includes/class-hvac-manage-event.php +++ b/includes/class-hvac-manage-event.php @@ -18,8 +18,8 @@ class HVAC_Manage_Event { * Constructor */ public function __construct() { - // Hook into content filter with low priority (99) to run after other filters - add_filter('the_content', array($this, 'ensure_shortcode_processing'), 99); + // DISABLED: Content filtering is now handled directly in the template + // add_filter('the_content', array($this, 'ensure_shortcode_processing'), 99); // Add authentication check for manage-event page add_action('template_redirect', array($this, 'check_manage_event_auth')); @@ -67,9 +67,15 @@ class HVAC_Manage_Event { HVAC_Logger::info('Original content: ' . substr($content, 0, 200), 'ManageEvent'); } - // Strip WordPress block editor comments - $content = preg_replace('//', '', $content); - $content = preg_replace('//', '', $content); + // Strip WordPress block editor comments - handle all variations + $content = preg_replace('//', '', $content); + $content = preg_replace('//', '', $content); + + // Also strip any remaining HTML comments that might contain shortcode references + $content = preg_replace('//', '', $content); + + // Clean up any extra whitespace + $content = trim($content); // Process all shortcodes in the content $processed_content = do_shortcode($content); @@ -245,7 +251,41 @@ class HVAC_Manage_Event { .hvac-notice.hvac-error ul { margin: 15px 0 15px 30px; } - '; + + '; } /** diff --git a/scripts/clear-manage-event-cache.sh b/scripts/clear-manage-event-cache.sh new file mode 100755 index 00000000..05aa9933 --- /dev/null +++ b/scripts/clear-manage-event-cache.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +echo "=== Clearing cache for manage event page ===" + +# Try to clear Breeze cache if available +if command -v wp &> /dev/null; then + echo "Clearing WordPress cache..." + wp cache flush 2>/dev/null || echo " - WordPress cache flush not available" + + echo "Clearing Breeze cache..." + wp breeze purge --cache=all 2>/dev/null || echo " - Breeze cache purge not available" + + echo "Clearing transients..." + wp transient delete --all 2>/dev/null || echo " - Transient deletion not available" +else + echo "WP-CLI not found. Manual cache clearing may be needed." +fi + +# Clear object cache files if they exist +if [ -d "/tmp/breeze" ]; then + echo "Clearing Breeze file cache..." + rm -rf /tmp/breeze/* +fi + +# Clear any server-side caches +if command -v redis-cli &> /dev/null; then + echo "Flushing Redis cache..." + redis-cli FLUSHALL 2>/dev/null || echo " - Redis flush failed or not configured" +fi + +if command -v service &> /dev/null; then + echo "Restarting PHP-FPM (if available)..." + sudo service php*-fpm restart 2>/dev/null || echo " - PHP-FPM restart not available" +fi + +echo "Cache clearing complete!" +echo "" +echo "Next steps:" +echo "1. Visit the manage event page in an incognito/private browser window" +echo "2. Check if the HTML comment is still appearing" +echo "3. If it still appears, the issue is likely in The Events Calendar plugin itself" \ No newline at end of file diff --git a/templates/page-manage-event.php b/templates/page-manage-event.php index c72d8a9e..7bd33741 100644 --- a/templates/page-manage-event.php +++ b/templates/page-manage-event.php @@ -10,12 +10,50 @@ get_header(); // This template ensures proper WordPress theme integration ?>
+ +
+

Create Event

+ +
+ post_content; + + // Strip ALL HTML comments that might contain shortcode references + // Use multiple patterns to catch all variations + $patterns = [ + '//s', + '//s', + '//s', + '//s' // Catch all remaining HTML comments + ]; + + foreach ($patterns as $pattern) { + $raw_content = preg_replace($pattern, '', $raw_content); + } + + // Clean up any extra whitespace + $raw_content = trim($raw_content); + + // Process shortcodes directly without the_content filter + $processed = do_shortcode($raw_content); + + // Output the processed content + echo $processed; endwhile; + else: + // No posts found - show the shortcode directly + echo do_shortcode('[tribe_community_events]'); endif; ?>