Are you trying to make WordPress search PDF files on your website?
WordPress allows you to upload PDF files to your site and store them in your media library. You can also make them available to your site visitors for download. By making WordPress search PDF files and their content, your users can find them more easily.
In this article, we’ll show you how to make WordPress search PDF files.
You’ll be able to do this in 2 simple steps. Let’s get started!
Why Search PDF Files in WordPress?
WordPress is the leading platform for building a website. Currently, 43.1% of all websites are powered by WordPress. It supports different document file formats, including PDFs, one of the most common formats for sharing documents online.
Are you an author, or do you own an online bookstore? WordPress offers all the features you need to showcase and sell your work.
Even if you own a blog, you can convert some of your long guides and tutorials into PDF files so your users can download and read them later.
You can offer PDF files for free download or sell them as individual products.
Whichever method you choose, you should make sure your site visitors can find these PDF files easily. To make this possible, your WordPress site must be able to index and search PDF files properly.
The native WordPress search can look for PDF files in your media library. But it will only consider the title and short description when searching. This means you won’t always get relevant results.
That’s why you need to use a WordPress plugin to offer a better search experience. The plugin should be able to index and search the PDF metadata and other important custom fields.
This way, your site visitors can find all the PDF files on your site faster.
So, let’s show you how to make WordPress search PDF files without any previous technical experience.
How To Make WordPress Search PDF Files Using SearchWP
The easiest way to make WordPress index and search PDF files is to use a plugin. SearchWP is the most powerful WordPress search plugin available in the market. It offers many advanced features that help improve your site’s search capabilities.
SearchWP doesn’t only index your PDF files’ titles, content, and short descriptions. Your users will be able to search using the metadata and other important custom fields. You can also adjust how relevant you want SearchWP to consider each attribute when searching.
What about other Office and rich text document formats like DOC, DOCX, and TXT files? SearchWP allows you to index and search them all, too.
Beyond indexing PDF and Office documents, SearchWP can do much more. You get to enjoy other features like:
- WooCommerce integration: Do you want to sell PDFs or any other type of products on your site? SearchWP integrates automatically with WooCommerce. Once you set it up, it will take over your native WooCommerce search. You can also add a custom WooCommerce search widget anywhere on your site.
- Keyword Stemming: When you turn on this feature, SearchWP will search for keywords similar to the one you typed. For example, you’ll see results for keywords like “running” and “runner” when you search for “run”. You can also customize how this works 100%.
- Multiple search engines: SearchWP allows you to create more than one search engine on a site. A search engine controls how your site searches for results. For example, you can add a search bar that indexes PDF files to only 1 page on your site. Other search fields on other pages will then search for other content types.
SearchWP provides full-fledged search functionalities that improve your native WordPress search in just a few clicks.
Now, let’s see how to use SearchWP to make WordPress search PDF files. All you need to do is follow these 2 steps.
Step 1: Install And Activate SearchWP
Are you ready to make WordPress search your PDF files? The first step is to grab your copy of SearchWP here.
You can download the plugin zip file from the Downloads tab of your account page.
Your license key is also available here, right next to your package name. Copy this Key to activate SearchWP in your WordPress dashboard later.
Now, log into your WordPress dashboard to install and activate the SearchWP plugin.
When you’re done, you’ll see a new menu item called SearchWP appear in the left panel of your WordPress dashboard.
The next thing is to activate the license. Click on SearchWP > Add License Key, and you’ll be taken to the Settings page.
Find the License section in the General tab. Now paste the license key that you copied earlier in its field. Click Verify Key.
If everything goes all right, the button will change to Remove Key, and you’ll see your package information below.
Congratulations! You’ve successfully activated the SearchWP plugin. It’s now ready for use.
Now, we’ll customize the search engine to search PDF files.
Step 2: Set Up SearchWP Engine to Make WordPress Search PDF Files
After activating SearchWP, you need to set up a search engine that searches PDF files on your site. Setting up a search engine is like adding a mini Google search algorithm to your site. It allows you to control how SearchWP will look for search results.
You can choose from different content sources like posts, pages, or the media library. You also get to decide how relevant each attribute from these sources should be when searching.
To make WordPress search PDF files, you need to select the media library as a source for your site search. To do this, navigate to SearchWP > Algorithm page.
Now, you can either edit the default search Engine or create a new one for searching PDF files. Click Add New to configure a new engine from scratch.
Now, from the popup modal, make sure Media is checked and name your Engine properly. Click Done to store the settings.
Now scroll to the Media tab and click Add/Remove Attributes. This is where you get to choose which elements of the media library SearchWP should index.
Make sure to check the Document Content and PDF metadata boxes, as we aim to make WordPress search PDF files and other types of documents. Then click Done.
You can also add specific rules to the Media tab. Click Edit Rules to do this.
For example, you can decide to show results for PDF files only. To do so, click Add Rule. You’ll need to set the Engine to show entries only when the file type is in PDFs. Click on the blank field and choose PDFs. Then click Done.
Finally, click Save Engines to save the new Engine settings.
SearchWP will then apply your new preferences by rebuilding your search index. However, depending on the state of your website, you may need to rebuild the index manually, in which case click Rebuild Index.
The following popup will appear soon after. What it means is when a PDF or document file is indexed in SearchWP, it extracts all indexable data, i.e., text, and stores it in its database. In other terms, a copy of the PDF or the document file is stored in the SearchWP database.
SearchWP is so advanced that it even lets you modify the extracted content from the original file. So you can take more control over the content. To do that, you need to open up the file from Media. Click on the PDF or document file of your choice. It’ll pop up a modal; click on Edit more details.
Now, you’ll see a section for SearchWP Document Content. This is where the extracted content is stored. If you wish, you can modify the data from here.
Let’s come back to the Reset Document Content modal. If you’ve modified any file and want to keep the changes, you must leave the checkbox as is. However, if you want to reset and scrape all the modifications you’ve made to all the files, then you need to check “Remove stored Document Content, PDF Metadata, and image EXIF when rebuilding index.” This will erase all modifications and restore all files to their initial format. Therefore, we advise you to proceed cautiously. Finally, click Continue Index Rebuild.
Congratulations! Your WordPress site can now index and search PDF files.
You can plug this Engine into any search form created with SearchWP. We have created a detailed guide on how to easily add search forms in different locations and use different Engines.
Now, when your site visitors search for a keyword or author’s name, they can find all the relevant PDF results.
You’ve learned how to make WordPress search PDF files in this article. Now, visitors can find all the PDF files on your website easily.
Ready to make your WordPress site search PDF files? Get started with SearchWP!
You can also check out our guides on how to add WordPress search by category or add a WooCommerce search form to your shop page.