Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
25 Million+
Websites using our plugins
Years of WordPress experience
WordPress tutorials
by experts

How to Add PDF Indexing and Searching in WordPress

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Do you want to add PDF indexing and searching in WordPress?

You can upload PDF files to the media library, but WordPress doesn’t include any PDF contents or metadata in its search results. This can make it more difficult for visitors to find what they’re looking for.

In this article, we’ll show you how to add PDF indexing and searching in WordPress.

How to Add  PDF Indexing and Searching in WordPress

Why Add PDFs to Your WordPress Search Results?

By uploading PDF files to your WordPress site, you can offer your visitors downloadable ebooks, user manuals, catalogs, and more. You can even add a PDF viewer in WordPress, so customers and visitors can see the PDF’s contents without downloading it.

By default, the built-in WordPress search shows the title and description of your PDFs and other files in its search results. However, it doesn’t show the document’s contents.

This isn’t very helpful and makes it more difficult for visitors to find what they’re looking for, even if the PDF is a good match for their search query.

The good news is that you can improve the WordPress search so that it includes PDF and other file contents in its search results.

With that being said, let’s take a look at how to add PDF indexing and searching in WordPress.

Adding PDFs to Your WordPress Search Results

The best way to add PDF indexing and searching in WordPress is by using SearchWP. It is the best WordPress search plugin that allows you to include all kinds of content in your search results, including custom post types, WooCommerce products, comments, PDFs, and more.

You can see our complete SearchWP review for more details.

The first thing you need to do is install SearchWP. For more details, see our step-by-step guide on how to install a WordPress plugin.

Upon activation, go to SearchWP » Settings and then click on the ‘General’ tab.

Improving the WordPress search using SearchWP

Here you need to enter your license in the ‘License Key’ box. You can find this information under your account on the SearchWP site. Once you’re done, make sure to click the ‘Verify Key’ button.

With that done, you’re ready to add the contents of your PDF documents to the WordPress search results, by going to SearchWP » Algorithm.

The SearchWP search optimization WordPress plugin

This brings you to a screen where you can specify what SearchWP should include in its search results, such as pages and posts.

By default, SearchWP should search your site’s media files. However, if you can’t see a ‘Media’ section, then you will need to add it by clicking the ‘Sources & Settings’ button.

Making more content searchable using SearchWP

This shows all the different content that you can include in the WordPress search results. For example, you can make blog comments searchable in WordPress.

In the popup, select ‘Media’ and then click on ‘Done.’

How to search media on your WordPress website

To include PDFs and other documents in the search results, scroll to the ‘Media’ section.

Here, click on the ‘Add/Remove Attributes’ button.

Adding and removing attributes to the WordPress search algorithm

In the popup that appears, check the ‘Document Content’ box, if it isn’t already selected.

This settings tells SeachWP to index the contents of your PDFs, Microsoft Office files, text files, and other documents in the WordPress media library. It will then include this content in any relevant search results.

You should also check the ‘PDF Metadata’ box. SearchWP will then index PDF metadata that isn’t part of the file’s contents, such as its title, author, subject, and keywords.

Adding PDF contents and metadata to the WordPress search

Depending on the PDF, this may help visitors find what they’re looking for. For example if you run an online marketplace, then metadata can help shoppers find the PDF user manual for a specific WooCommerce product. With that in mind, it’s often smart to include this information in the search results.

When you’re happy with the changes you’ve made, click on the ‘Done’ button.

‘Document Content’ and ‘PDF metadata’ will now appear in the ‘Media’ section, along with any other attributes that SearchWP searches by default such as title and slug.

You’ll notice that each item has an ‘Applicable Attribute Relevance’ scale. This is the weight that SearchWP will give to each attribute.

Fine-tuning the WordPress search algorithm on your WordPress blog or website

Content that matches an attribute with high relevancy will appear higher in the search results. By contrast, content that matches an attribute that has less relevancy will appear lower in the user’s search results.

By default, the sliders for Document Contents and PDF Metadata are all the way to the left, so they don’t carry much weight weight. If you want the document content and PDF metadata to have a bigger impact on the search results, then simply move the sliders.

Changing the attribute relevancy sliders in the search algorithm

Every WordPress website is unique, so you may want to try different relevancy settings to see what gives you the most accurate and helpful search results. For example, if you’ve uploaded the menu as a PDF on your restaurant website, then this is important content and you’ll typically want to show it high in the search results.

Once you’re happy with how the search feature is set up, scroll to the top of the screen and click the ‘Save’ button.

Saving your custom WordPress search algorithm

SearchWP will now rebuild the index automatically. Depending on the speed of your Internet connection and your WordPress hosting provider, this may take a few minutes.

As soon as you see ‘Index Status 100%,’ you’ll know that SearchWP has added all the PDF contents and metadata to its search index.

Rebuilding your WordPress search index

Congratulations! Your WordPress blog, website, or online store will now show PDF content and metadata in its search results.

How to Improve Your New WordPress Search

Now you’ve added PDF indexing and searching in WordPress, you may want to enable some of SearchWP’s more advanced features. This will make it even easier for visitors to find what they’re looking for.

To do that, go to SearchWP » Settings and scroll to the ‘General Settings’ section.

Improving the WordPress search using SearchWP's advanced settings

Here, you can activate any of the following settings:

  • Partial matches. With this setting enabled, SearchWP will display results that aren’t an exact match for the visitor’s search query.
  • Closest match. After enabling partial matches, you can also show the closest matches when a search has no results.
  • “Quoted” searches. This allows visitors to search for exact phrases use quotes.
  • Highlight terms. Automatically highlights the search terms to help visitors find what they’re looking for.

We hope this tutorial helped you learn how to add PDF indexing and searching in WordPress. You may also want to learn how to create a WordPress membership site, or check out list of must have plugins to grow your site.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

3 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Ed Tow says

    DYNAMITE post! The reasons you give are several well-chosen ones out of literally dozens. For many non-profits and others, “newsletters” have been the very heart of their communications process. “Looking for an article on X” is a close relative of what’s made Google one of the very largest companies on earth. But PDF’s – so very common – are (as you point out) all but “foreign language” for reasons I cannot really grasp. Google ostensibly indexes them, but there is some complexity (way beyond “Were they scanned?”) that renders it hit-and-miss in this connection.

    How I hope that SearchWP has some sort of “trial” feature, because if Google hasn’t nailed it, I’m more than a little skeptical that someone else has!

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.