Title: Exclude form data into excerpts
Last modified: June 26, 2020

---

# Exclude form data into excerpts

 *  [jayaram558](https://wordpress.org/support/users/jayaram558/)
 * (@jayaram558)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/)
 * Hi,
 * I have a website where all the pages have a banner with the form on top. When
   I search for text, the results show up, but in the excerpt, the form select options
   are rendering. How do I exclude a certain div from searching?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fexclude-form-data-into-excerpts%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 14 replies - 1 through 14 (of 14 total)

 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/#post-13039745)
 * See “Avoiding indexing menus” on [https://www.relevanssi.com/knowledge-base/divi-page-builder-and-cleaner-excerpts/](https://www.relevanssi.com/knowledge-base/divi-page-builder-and-cleaner-excerpts/)
 *  Thread Starter [jayaram558](https://wordpress.org/support/users/jayaram558/)
 * (@jayaram558)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/#post-13048159)
 * Hi Mikko,
 * I have tried the below, but unable to excldue the form from the excerpt.
 *     ```
       add_filter( 'relevanssi_post_content', 'rlv_remove_menu' );
       add_filter( 'relevanssi_excerpt_content', 'rlv_remove_menu' );
       function rlv_remove_menu( $content ) {
           $content = preg_replace( '~\[et_pb_fullwidth_code admin_label="Get in touch.*?\[/et_pb_fullwidth_code\]~ims', '', $content );
           return $content;
       }
       ```
   
 * Can you please help. This is the search url – [https://www.y-axis.com/?s=canada+pr](https://www.y-axis.com/?s=canada+pr)
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/#post-13048386)
 * Does this slightly wider version work?
 *     ```
       add_filter( 'relevanssi_post_content', 'rlv_remove_menu' );
       add_filter( 'relevanssi_excerpt_content', 'rlv_remove_menu' );
       function rlv_remove_menu( $content ) {
           $content = preg_replace( '~\[et_pb_fullwidth_code.*?Get in touch.*?\[/et_pb_fullwidth_code\]~ims', '', $content );
           return $content;
       }
       ```
   
 * If not, can you check what the shortcode exactly looks like in the database? 
   You can use this to check how Relevanssi sees the post: [https://www.relevanssi.com/knowledge-base/debugging-indexing-problems/](https://www.relevanssi.com/knowledge-base/debugging-indexing-problems/)
 *  Thread Starter [jayaram558](https://wordpress.org/support/users/jayaram558/)
 * (@jayaram558)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/#post-13048860)
 * Hi Mikko,
 * The code you have given didn’t help. Unable to exclude the form from top section.
 * I have added the debug code. You can see it here – [https://www.y-axis.com/visa/work/canada/provincial-nominee-program/](https://www.y-axis.com/visa/work/canada/provincial-nominee-program/)
 * You can see the output here – [https://ibb.co/HpLVjps](https://ibb.co/HpLVjps)
 * It only shows the HTML of the page but no shortcodes. How do I Exclude the form
   on top? The form is on 90% of the pages. So all pages are showing the select 
   dropdown options in the excerpt.
    -  This reply was modified 6 years, 1 month ago by [jayaram558](https://wordpress.org/support/users/jayaram558/).
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/#post-13051607)
 * Try moving the filters to an earlier priority, ie. change the `add_filter`part
   to this:
 *     ```
       add_filter( 'relevanssi_post_content', 'rlv_remove_menu', 8 );
       add_filter( 'relevanssi_excerpt_content', 'rlv_remove_menu', 8 );
       ```
   
 * Does that help?
    -  This reply was modified 6 years, 1 month ago by [Mikko Saari](https://wordpress.org/support/users/msaari/).
 *  Thread Starter [jayaram558](https://wordpress.org/support/users/jayaram558/)
 * (@jayaram558)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/#post-13052954)
 * No Luck. it’s still the same.
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/#post-13056468)
 * If you change the code to this and then go save one of the posts with the form,
   what do you get?
 *     ```
       add_filter( 'relevanssi_post_content', 'rlv_remove_menu', 8 );
       function rlv_remove_menu( $content ) {
           var_dump($content);
           exit();
           return $content;
       }
       ```
   
 *  Thread Starter [jayaram558](https://wordpress.org/support/users/jayaram558/)
 * (@jayaram558)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/#post-13061706)
 * Here is the results of what you asked – [https://pastebin.com/52P16sfB](https://pastebin.com/52P16sfB)
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/#post-13061746)
 * One more try:
 *     ```
       add_filter( 'relevanssi_post_content', 'rlv_remove_menu', 8 );
       add_filter( 'relevanssi_excerpt_content', 'rlv_remove_menu', 9 );
       function rlv_remove_menu( $content ) {
           $content = preg_replace( '/\[et_pb_fullwidth_code.*?\].*\[\/et_pb_fullwidth_slider\]/im', '', $content );
           return $content;
       }
       ```
   
 * This will remove all `et_pb_fullwidth_code` elements, and matches what Relevanssi
   does to remove Divi stuff currently. (Using `ims` may actually be the problem,
   Relevanssi just uses `im`.)
 * (I’m going to add this to the Relevanssi default behaviour in the next version.)
 *  Thread Starter [jayaram558](https://wordpress.org/support/users/jayaram558/)
 * (@jayaram558)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/#post-13062152)
 * Hi Mikko,
 * Still no luck. its the same and rending the form in search results.
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/#post-13062164)
 * Are you sure those excerpts are generated by Relevanssi in the first place? If
   the excerpts are generated by Divi, then nothing you do with Relevanssi filters
   is going to change it. If you adjust the excerpt length, do the excerpts change?
 *  Thread Starter [jayaram558](https://wordpress.org/support/users/jayaram558/)
 * (@jayaram558)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/#post-13062199)
 * I have changed 30 to 50 in Excerpts and highlights settings. But nothing has 
   changed. Where do I update the settings?
 * IF the excerpts are created by divi, how do I change it?
 *  Thread Starter [jayaram558](https://wordpress.org/support/users/jayaram558/)
 * (@jayaram558)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/#post-13062217)
 * Mikko,
 * Ok. I have changed truncate_post( 470 ); to the_excerpt(); in search.php and 
   it worked now. Thanks, Much for your help!
 * One more quick question. I have selected to match the full word and unchecked
   OR fallback. But still, I get both the results. Why is that?
 * Example: if I search for Canada pr, I get results for Canada and also PR where
   if we have a word program, we get that into results. How do we make it an exact
   match?
    -  This reply was modified 6 years, 1 month ago by [jayaram558](https://wordpress.org/support/users/jayaram558/).
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/#post-13062393)
 * If you haven’t touched the advanced indexing settings and adjusted the minimum
   word length from 3 to 2, “pr” is simply discarded and search for “canada pr” 
   is just a search for “canada”. If you set the minimum word length to 2 and then
   reindex, the search should work as expected.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Exclude form data into excerpts’ is closed to new replies.

 * ![](https://ps.w.org/relevanssi/assets/icon-256x256.png?rev=3529670)
 * [Relevanssi - A Better Search](https://wordpress.org/plugins/relevanssi/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/relevanssi/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/relevanssi/)
 * [Active Topics](https://wordpress.org/support/plugin/relevanssi/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/relevanssi/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/relevanssi/reviews/)

 * 14 replies
 * 2 participants
 * Last reply from: [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-form-data-into-excerpts/#post-13062393)
 * Status: not resolved