Click Here to view my website.
If you will try the search bar, it will not display most of the text inside the page.
Its because most of the text inside the page are generated by "shortcodes".
How do I fix this one?
Pls help...
Click Here to view my website.
If you will try the search bar, it will not display most of the text inside the page.
Its because most of the text inside the page are generated by "shortcodes".
How do I fix this one?
Pls help...
Short answer: the text produced by shortcodes is rendered at page display time, not stored as plain text in the database fields WordPress searches. That explains why s search misses most of the content and why pointed toward a “search everything” approach. Two practical, reliable options follow.
Use a better indexer (recommended)
function my_relevanssi_index_shortcodes( $content, $post ) {
if ( ! is_object( $post ) ) {
return $content;
}
$rendered = wp_strip_all_tags( do_shortcode( $post->post_content ) );
return $content . ' ' . $rendered;
}
add_filter( 'relevanssi_content_to_index', 'my_relevanssi_index_shortcodes', 10, 2 ); Persist rendered text at save (alternative)
function save_rendered_content_for_search( $post_id, $post, $update ) {
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return;
if ( wp_is_post_revision( $post_id ) ) return;
$rendered = wp_strip_all_tags( do_shortcode( $post->post_content ) );
update_post_meta( $post_id, '_rendered_search_content', $rendered );
}
add_action( 'save_post', 'save_rendered_content_for_search', 10, 3 ); Notes and cautions
wp_strip_all_tags. fast answer:
No fast solution, installa a sarch everything plugin, and complete each post/page with "real data" using excerpts, custom fields, etc...
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.