WP-discourse: how to deal with shortcodes in post

Сработало отлично! Ещё раз спасибо за поддержку.

@simon

Теперь я хочу добавить текст поста, скрытый в теме, чтобы его находила функция поиска и корректно сканировали поисковые роботы.

Какие изменения мне нужно внести в мой текущий код ниже, чтобы обернуть содержимое поста в <div style="display:none;">...</div>?

// Удаляет всё, что похоже на шорткод. Это удалит из поста всё,
// что находится внутри квадратных скобок `[...]`.
add_filter( 'wp_discourse_excerpt', 'testeleven_remove_shortcodes' );
function testeleven_remove_shortcodes( $excerpt ) {
    $excerpt = preg_replace( '/\[.*\]/', '', $excerpt );

    return $excerpt;
}
// Показывает записи WordPress, встроенные в Discourse через iframe
// https://meta.discourse.org/t/wp-discourse-how-to-deal-with-shortcodes-in-post/58838/5
add_filter( 'discourse_publish_format_html', 'wpdc_custom_discourse_publish_format_html', 10, 2 );
function wpdc_custom_discourse_publish_format_html( $output, $post_id ) {
    $permalink = get_the_permalink( $post_id );
    ob_start();
	?>
    
    <div style="display:none;"><?php echo esc_html( get_the_content( $post_id ) ); ?></div>
    <iframe width="690" height="2000" src="<?php echo esc_url( $permalink ); ?>" frameborder="0"></iframe>
	<?php

	return ob_get_clean();
}