Skip to main contentSkip to footer

Visual Composer and WP Bakery have a Raw HTML element that can be used to add HTML code to your pages. By default, this content is stored in an encoded format Relevanssi can’t read. Fortunately, the encoding is simple Base64 encoding that is easy to read.

So, in order to read the contents of the Raw HTML element, all it takes is a custom function that finds the encoded content, decodes it and adds it to the post so Relevanssi can see it. We can use the relevanssi_post_content filter hook to modify the post content. Add this function to your site:

add_filter( 'relevanssi_post_content', 'rlv_vc_raw_html', 8 );
function rlv_vc_raw_html( string $content ) : string {
  if ( preg_match_all( '/\
	
(.*?)\[\/vc_raw_html\]/', $content, $matches ) > 0 ) { foreach ( $matches[1] as $encoded_data ) { $raw_html = urldecode( base64_decode( $encoded_data ) ); $content .= ' ' . $raw_html; } } return $content; }

This function needs to run on a priority lower than 9, because on priority 9 Relevanssi runs the relevanssi_remove_page_builder_shortcodes() function that removes page builder shortcodes and in the case of

also removes the encoded content.

Your account

Not logged in. Log in to see your license details.

Search

Popular Resources

WooCommerce: Aelia Prices by Country product visibility

…$post = get_post( $post_id ); $post_type = $post->post_type; $product_id = $post->ID; if ( ‘product‘ === $post_type && function_exists( ‘wc_get_product’ ) ) { // Get the product object. $product = wc_get_product( $product_id ); // Check if the product is purchasable. if ( $product && ! $product->is_purchasable() ) { $post_ok = false;……Check if the product is purchasable. if ( $product && ! $product->is_purchasable() ) { $post_ok = false; } } return $post_ok; } This function uses the relevanssi_post_ok filter hook to control which posts are included in the search and the $product->is_purchasable() function to see if the product can be shown….Aelia has a Prices by Country for WooCommerce plugin, which can adjust prices based on customer country and hide products unavailable in a specific country. Jason James shared a function that makes Relevanssi hide unavailable products in search: add_filter( ‘relevanssi_post_ok’, ‘relevanssi_aelia_compatibility’, 10, 2 ); function relevanssi_aelia_compatibility( $post_ok, $post_id ) {…

Search is ignoring accents
In general, searches ignore accents, which is generally a good idea: for example in French, the difference between e and…
Index only short numbers
Relevanssi has a minimum word length setting that is set to three characters. Any one- or two-letter words are not…

Related Posts:

Comment Section:

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed