Better Search Pro > Tools, or `wp bsearch ecsi reindex --force`. */ if ( ! function_exists( 'bsearch_efn_integration_extract_notes' ) ) { /** * Extract footnote text from Easy Footnotes shortcodes before it is discarded. * * @param string[] $extra_parts Extra text fragments already queued for the index. * @param string $content Raw post content, before block/shortcode processing. * @return string[] Extra text fragments, with recovered footnote text appended. */ function bsearch_efn_integration_extract_notes( array $extra_parts, string $content ): array { if ( ! class_exists( 'easyFootnotes' ) ) { return $extra_parts; } // Easy Footnotes registers both [note] and [efn_note] as aliases of the same shortcode. $pattern = get_shortcode_regex( array( 'note', 'efn_note' ) ); if ( ! preg_match_all( '/' . $pattern . '/', $content, $matches, PREG_SET_ORDER ) ) { return $extra_parts; } foreach ( $matches as $match ) { // Skip escaped shortcodes, e.g. [[efn_note]]...[[/efn_note]]. if ( '[' === $match[1] && ']' === $match[6] ) { continue; } $note = trim( $match[5] ); if ( '' === $note ) { continue; } $extra_parts[] = wp_strip_all_tags( do_shortcode( $note ) ); } return $extra_parts; } } if ( ! has_filter( 'bsearch_pre_index_content_parts', 'bsearch_efn_integration_extract_notes' ) ) { add_filter( 'bsearch_pre_index_content_parts', 'bsearch_efn_integration_extract_notes', 10, 2 ); } if ( ! has_filter( 'crp_pre_index_content_parts', 'bsearch_efn_integration_extract_notes' ) ) { add_filter( 'crp_pre_index_content_parts', 'bsearch_efn_integration_extract_notes', 10, 2 ); }