ID); // Look for Elementor FAQ widget shortcode or data if (strpos($post_content, 'elType":"accordion') !== false || strpos($post_content, 'elType":"toggle') !== false || strpos($post_content, 'faq') !== false) { // Remove Yoast's FAQPage schema to prevent duplicates add_filter('wpseo_schema_graph', function($graph) { foreach ($graph as $key => $piece) { if (isset($piece['@type']) && $piece['@type'] === 'FAQPage') { unset($graph[$key]); } } return array_values($graph); // Re-index array }, 10, 1); } } } add_action('wp_head', 'fix_duplicate_faq_schema', 1); ?>