Title: excluding section
Last modified: July 26, 2021

---

# excluding section

 *  Resolved [wissam6](https://wordpress.org/support/users/wissam6/)
 * (@wissam6)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/excluding-section/)
 * Hello,
    I’m using Divi along Relevanssi. in on of my pages i have a section in
   the begining of the page, i want to exclude it from the search, is it possible?
 * thx

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

 *  Thread Starter [wissam6](https://wordpress.org/support/users/wissam6/)
 * (@wissam6)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/excluding-section/#post-14702688)
 * sorry i think i was not clear:
    actually when i do search, in the result page
   it show also the 2-3 first line of my page (i think it is in defined setting “
   Length of the snippet”). what i need is to not show these lines, i want to skip
   it, is it possible?
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/excluding-section/#post-14704155)
 * Yes, it’s possible. You can use the [`relevanssi_excerpt_content`](https://www.relevanssi.com/user-manual/filter-hooks/relevanssi_excerpt_content/)
   filter hook to modify the post before Relevanssi creates the excerpt. Remove 
   the unwanted content from the post in that filter hook, and it won’t appear in
   the excerpts.
 *  Thread Starter [wissam6](https://wordpress.org/support/users/wissam6/)
 * (@wissam6)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/excluding-section/#post-14713731)
 * hi, thanks for your reply, so the post is saying:
 * To remove all parts of the **post marked with the relevanssi_noindex class from
   the excerpts**, you can use this:
    add_filter( ‘relevanssi_excerpt_content’, ‘
   rlv_remove_noindex_class’ ); function rlv_remove_noindex_class( $content ) { 
   return preg_replace( ‘#<(.*) class=”.*?relevanssi_noindex”.*?</\1>#ms’, ”, $content);}
 * but how can i mark a part of my post with this class? (i am using divi and in
   the beginning of my post i have a section which i don’t want to appear in the
   excerpt)
 * thx
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/excluding-section/#post-14713744)
 * You don’t, that’s just an example of how the filter hook is used, and not related
   to your case here.
 * The `$content` variable has your post content in it, and you need to create a
   filter function that removes the unwanted part of the content from the variable
   and then returns that.
 * You can use the example, you just need to replace the `#<(.*) class=”.*?relevanssi_noindex”.*?
   </\1>#ms` with a regex that will remove the part you want removed. Since I have
   no idea what that part looks like, I can’t unfortunately be more specific here.
 *  Thread Starter [wissam6](https://wordpress.org/support/users/wissam6/)
 * (@wissam6)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/excluding-section/#post-14715017)
 * THANKS A LOT

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

The topic ‘excluding section’ is closed to new replies.

 * ![](https://ps.w.org/relevanssi/assets/icon-256x256.png?rev=2025044)
 * [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/)

## Tags

 * [excluding](https://wordpress.org/support/topic-tag/excluding/)

 * 5 replies
 * 2 participants
 * Last reply from: [wissam6](https://wordpress.org/support/users/wissam6/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/excluding-section/#post-14715017)
 * Status: resolved