Continue reading Indexing embedded PDFs for the parent post

Indexing embedded PDFs for the parent post

…} } return $block; } ); PDF.js Viewer Shortcode PDF.js Viewer Shortcode uses a shortcode with the file name in the url parameter. add_filter( ‘relevanssi_content_to_index’, ‘rlv_pdfjs_content’, 10, 2 ); function rlv_pdfjs_content( $content, $post ) { $m = preg_match_all( ‘/\[pdfjs-viewer url=[“\’](.*?)[“\’]/’, $post->post_content, $matches ); if ( $m ) { global $wpdb;……need to establish a connection between the PDF and the post, based on the URL in the shortcode. The same code works with different PDF embedders; you only have to adjust the regex to match the shortcode used by the plugin. WordPress Core File block If you use the default……WordPress. Thus, Relevanssi won’t know the PDF is embedded in the post and cannot index the PDF contents for the parent post. Most of these plugins use shortcodes to embed the PDF viewer on a page. To get Relevanssi to index the embedded PDF contents for the parent post, you…

Read more Indexing embedded PDFs for the parent post 5 Comments on Indexing embedded PDFs for the parent post
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. Add this function to your site…

Read more Indexing post slugs 0 Comment on Indexing post slugs
Continue reading Blocking pre and code tags

Blocking pre and code tags

If your posts have lots of programming code examples in <pre> and <code> tags, those might look pretty bad in the search results. A snippet of programming code isn’t usually a good excerpt, and if you use those tags purely for code snippets, they won’t likely contain significant search content, either. Fortunately it’s easy to…

Read more Blocking pre and code tags 0 Comment on Blocking pre and code tags
Continue reading ACF: Indexing ACF fields for taxonomy terms

ACF: Indexing ACF fields for taxonomy terms

Advanced Custom Fields makes it possible to add custom fields to taxonomy terms. You can only do this with Relevanssi Premium because the free version of Relevanssi can’t index taxonomy terms. Suppose you set Relevanssi to index custom fields. Relevanssi won’t index these taxonomy custom fields because taxonomy terms aren’t generally allowed to have custom…

Read more ACF: Indexing ACF fields for taxonomy terms 2 Comments on ACF: Indexing ACF fields for taxonomy terms
Continue reading Index custom field contents

Index custom field contents

Custom fields (also known as post meta or meta fields) are a major part of WordPress the default search won’t search. That’s a big problem for people who use solutions like Advanced Custom Fields or Carbon Fields to develop sites: on sites developed with custom field plugins large parts of the post, content may be…

Read more Index custom field contents 50 Comments on Index custom field contents
Continue reading Indexing and searching PDFs in WordPress

Indexing and searching PDFs in WordPress

…service on a separate server. Which PDF files can you index? Since Relevanssi is a WordPress search, Relevanssi operates on WordPress posts (including all the different post types). So, to have Relevanssi index your PDFs, they need to be WordPress posts. That’s fortunately really simple: upload your PDF files to……or EU. You can choose from the settings which server you want to use. There the files are processed with Tika. While we don’t care what’s inside the files you index on our server, the server needs to make working copies. The server removes the documents after use. It is……attachments? Yes! Relevanssi can handle lots of different formats. Our server uses Apache Tika to process the files, giving us a wide variety of supported formats. The essential document formats are covered: Word documents (DOC and DOCX), Open Office documents (ODT), RTFs, etc. How does the attachment indexing work? Relevanssi…

Read more Indexing and searching PDFs in WordPress 78 Comments on Indexing and searching PDFs in WordPress
Continue reading WooCommerce: Indexing product variation SKUs for main product

WooCommerce: Indexing product variation SKUs for main product

Relevanssi can index product and product variation SKUs for WooCommerce products: just add _sku to list of custom fields to index. However, if you want to find the main product when searching for the product variation SKU, you need some extra code using the relevanssi_content_to_index filter hook. Add this function to your site and rebuild…

Read more WooCommerce: Indexing product variation SKUs for main product 16 Comments on WooCommerce: Indexing product variation SKUs for main product
Continue reading Indexing private custom fields for admins only

Indexing private custom fields for admins only

I use private custom fields. I want to index them in the administration but not on the public site. How to do ? Initially this seems impossible to do with Relevanssi, but it’s possible. Doing this requires Relevanssi Premium. The free version doesn’t know which custom field matches the search term, it just knows some custom…

Read more Indexing private custom fields for admins only 0 Comment on Indexing private custom fields for admins only