Continue reading Why is a post type excluded from search?

Why is a post type excluded from search?

In the list of post types to index in the Relevanssi indexing settings tab there’s a column “Excluded from search”, which has a value of “yes” or “no” for each post type. What does this mean, and why does the value remain “yes” even if you set Relevanssi to index that post type? This column…

Read more Why is a post type excluded from search? 0 Comment on Why is a post type excluded from search?
Continue reading Restricting posts in the index

Restricting posts in the index

The relevanssi_indexing_restriction filter hook is often the best way to restrict what goes in the Relevanssi index and what not. There’s also relevanssi_do_not_index, which is also a fine way to approach this and is often easier to apply when you’re talking about blocking individual posts, but for larger exclusions, relevanssi_indexing_restriction is better. Extensive use of…

Read more Restricting posts in the index 0 Comment on Restricting posts in the index
Continue reading Indexing only attributes from shortcodes

Indexing only attributes from shortcodes

I need to add some custom shortcodes to the list of the “removed” ones (so they don’t show in plain text in the results). However, some of them are built like [shortcode_name text=”Need to keep this in results”] and I would like the content in the text parameter to stay in the results. How do I go about this?…

Read more Indexing only attributes from shortcodes 0 Comment on Indexing only attributes from shortcodes
Continue reading Indexing product codes with and without spaces

Indexing product codes with and without spaces

A Relevanssi Premium customer had a problem with product codes. The codes are in the format “ABC 100”, that is a group of letters and a group of digits with a space in between. Users may search for the codes without the space, so the post should be found with either “ABC 100” or “ABC100”.…

Read more Indexing product codes with and without spaces 5 Comments on Indexing product codes with and without spaces
Continue reading Excluding old content from the search

Excluding old content from the search

Is there a way to exclude anything before 2016 from search results? Yes. There are two approaches to this. If you never want to see anything old in the results, it’s best to filter in indexing. Add this to your theme functions.php: Note that the restriction explains which posts are included in the index, so…

Read more Excluding old content from the search 0 Comment on Excluding old content from the search
Continue reading Indexing image captions for the posts

Indexing image captions for the posts

The use case is I run several newspapers, and the “caption” field when uploading media is where the journalists put the photographer credit. We need to be able to index the photographer bylines, but ideally would want to return the story/commentary where their image was used, not the image itself. If you want to index…

Read more Indexing image captions for the posts 0 Comment on Indexing image captions for the posts
Continue reading Indexing embedded PDFs for the parent post

Indexing embedded PDFs for the parent post

Relevanssi can automatically index PDF content for the parent post, if the PDF (or other attachment) is attached to the parent post in WordPress. However, that’s not always the case. Sometimes the PDF is attached to the page using an embed, and that doesn’t create a connection between the posts in WordPress. Thus, Relevanssi won’t…

Read more Indexing embedded PDFs for the parent post 0 Comment on Indexing embedded PDFs for the parent post
Continue reading Indexing HTML comments

Indexing HTML comments

By default, Relevanssi does not index HTML comments inside your posts. Relevanssi removes all HTML tags before indexing, and HTML comments (<!– like this –>) are counted as HTML tags. If you have content inside comments that you want indexed, you need to modify the punctuation control – which is responsible for removing the comments…

Read more Indexing HTML comments 0 Comment on Indexing HTML comments
Continue reading Indexing post slugs

Indexing post slugs

By default Relevanssi does not index the post slug. It is, however, an easy thing to fix using the relevanssi_content_to_index filter hook. This function will read the post slug, replace the hyphens with spaces (so that indexing-post-slugs becomes “indexing post slugs”) and add the slug to the post content. Just add this function to your…

Read more Indexing post slugs 0 Comment on Indexing post slugs