{"id":2667,"date":"2021-12-08T15:36:46","date_gmt":"2021-12-08T15:36:46","guid":{"rendered":"https:\/\/rengga.dev\/blog\/?p=2667"},"modified":"2023-06-12T14:39:33","modified_gmt":"2023-06-12T14:39:33","slug":"how-to-make-custom-fields-searchable-in-wordpress","status":"publish","type":"post","link":"https:\/\/rengga.dev\/blog\/how-to-make-custom-fields-searchable-in-wordpress\/","title":{"rendered":"How to Make Custom Fields Searchable in WordPress"},"content":{"rendered":"<p>Do you want your visitors to easily search custom fields to find content on your website?<\/p>\n<p>WordPress search doesn\u2019t work with custom fields by default, which can make it harder for your visitors to find what they need. By making custom fields searchable, you can provide a better user experience for your visitors.<\/p>\n<p>In this article, we\u2019ll show you how to make custom fields searchable in WordPress.<\/p>\n<h4>What Are Custom Fields &amp; Why Make Them Searchable?<\/h4>\n<p>WordPress custom fields\u00a0allow you to store any kind of additional information (metadata) about a post or page.<\/p>\n<p>WordPress adds metadata such as\u00a0title, author, date, time, and more to your posts and pages. With custom fields, you can add more information about your content, and display them on your website if you wish. A lot of popular\u00a0WordPress plugins\u00a0and themes use custom fields to store important data.<\/p>\n<p>For example, the content you enter in your WordPress SEO plugins such as\u00a0<a title=\"All in One SEO\" href=\"https:\/\/aioseo.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">All in One SEO<\/a>\u00a0is technically a custom field, or custom product attributes that you may add to your WooCommerce products sometimes are also custom fields.<\/p>\n<figure class=\"wp-block-image size-full is-style-default\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-106751 lazyloaded\" title=\"AIOSEO Product Title Optimization\" src=\"https:\/\/cdn4.wpbeginner.com\/wp-content\/uploads\/2021\/12\/aioseo-product-title-optimize.png\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" srcset=\"https:\/\/cdn4.wpbeginner.com\/wp-content\/uploads\/2021\/12\/aioseo-product-title-optimize.png 680w, https:\/\/cdn4.wpbeginner.com\/wp-content\/uploads\/2021\/12\/aioseo-product-title-optimize-300x176.png 300w\" alt=\"AIOSEO Product Title Optimization\" width=\"680\" height=\"398\" data-ll-status=\"loaded\" \/><\/figure>\n<p>However, WordPress doesn\u2019t search content on your website using custom fields. By default, when a visitor uses a\u00a0search bar\u00a0on your website, WordPress will only show them results where the title and content match their search terms.<\/p>\n<p>Making your custom fields searchable improves the user experience on your\u00a0WordPress website. It allows your visitors to search for any content with ease, keeping them on your website longer and reducing any frustration.<\/p>\n<p>That said, let\u2019s look at how you can make custom fields searchable.<\/p>\n<h4>Making Custom Field Searchable in WordPresss<\/h4>\n<p>The easiest way to make custom fields searchable is by using the\u00a0<a title=\"SearchWP\" href=\"https:\/\/searchwp.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">SearchWP<\/a>\u00a0plugin. It\u2019s the\u00a0best WordPress search plugin\u00a0and allows you to adjust the search algorithm without editing code.<\/p>\n<p>The plugin indexes everything on your WordPress site. For instance, it uses custom fields, PDF documents, text, custom tables, files, categories, shortcodes, and more to\u00a0improve WordPress search\u00a0for your users.<\/p>\n<p>Besides that, SearchWP works seamlessly with other popular plugins like Advanced Custom Fields, Meta Box, Toolset,\u00a0<a title=\"Easy Digital Downloads\" href=\"https:\/\/easydigitaldownloads.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Easy Digital Downloads<\/a>,\u00a0WooCommerce, and Pods.<\/p>\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/searchwp.com\/\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-107621 lazyloaded\" title=\"SearchWP\" src=\"https:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2021\/12\/searchwp.png\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" srcset=\"https:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2021\/12\/searchwp.png 680w, https:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2021\/12\/searchwp-300x162.png 300w\" alt=\"SearchWP\" width=\"680\" height=\"367\" data-ll-status=\"loaded\" \/><\/a><\/figure>\n<p>To start indexing your custom fields, first you\u2019ll need to install and activate the SearchWP plugin. If you need help, then please see our guide on\u00a0how to install a WordPress plugin.<\/p>\n<p>Upon activation, you can head over to\u00a0<strong>Settings \u00bb SearchWP<\/strong>\u00a0and then navigate to the \u2018Engines\u2019 tab from the WordPress admin panel.<\/p>\n<p>After that, you\u2019ll need to click the \u2018Add\/Remove Attributes\u2019 button to add custom fields to the search algorithm for your posts, pages, and media.<\/p>\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-107595 lazyloaded\" title=\"Add and remove attributes\" src=\"https:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2021\/12\/add-and-remove-attributes.png\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" srcset=\"https:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2021\/12\/add-and-remove-attributes.png 680w, https:\/\/cdn.wpbeginner.com\/wp-content\/uploads\/2021\/12\/add-and-remove-attributes-300x201.png 300w\" alt=\"Add and remove attributes\" width=\"680\" height=\"455\" data-ll-status=\"loaded\" \/><\/figure>\n<p>When you click the button, a popup window will now appear.<\/p>\n<p>Go ahead and click the dropdown menu under Custom Fields and then select the \u2018Any Meta Key\u2019 option to make all your custom fields searchable. Or you can type the custom fields you want to include during the search process. if you don\u2019t want to include them all.<\/p>\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-107598 lazyloaded\" title=\"Choose any meta key\" src=\"https:\/\/cdn.wpbeginner.com\/wp-content\/uploads\/2021\/12\/choose-any-meta-key.png\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" srcset=\"https:\/\/cdn.wpbeginner.com\/wp-content\/uploads\/2021\/12\/choose-any-meta-key.png 680w, https:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2021\/12\/choose-any-meta-key-300x169.png 300w\" alt=\"Choose any meta key\" width=\"680\" height=\"383\" data-ll-status=\"loaded\" \/><\/figure>\n<p>Once you\u2019ve chosen the custom fields, simply click the \u2018Done\u2019 button.<\/p>\n<p>A custom fields option will now be added to the search algorithm for posts. You can see the \u2018Custom Fields\u2019 under the Applicable Attribute Relevance section.<\/p>\n<p>Next, you can adjust the attribute slider to set the relevance weight given to each attribute during a search.<\/p>\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-107600 lazyloaded\" title=\"Adjust the search relevance\" src=\"https:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2021\/12\/adjust-the-search-relevance.png\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" srcset=\"https:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2021\/12\/adjust-the-search-relevance.png 680w, https:\/\/cdn2.wpbeginner.com\/wp-content\/uploads\/2021\/12\/adjust-the-search-relevance-300x150.png 300w\" alt=\"Adjust the search relevance\" width=\"680\" height=\"338\" data-ll-status=\"loaded\" \/><\/figure>\n<p>For example, if you move the slider to the right and set it to maximum, then SearchWP will give high preference to the data in the custom fields when searching content on your site.<\/p>\n<p>You can now repeat the step for making custom fields searchable for pages and media files.<\/p>\n<p>After making these changes, don\u2019t forget to click the \u2018Save Engines\u2019 button.<\/p>\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-107604 lazyloaded\" title=\"Click the Save Engines button\" src=\"https:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2021\/12\/save-engines.png\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" srcset=\"https:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2021\/12\/save-engines.png 680w, https:\/\/cdn2.wpbeginner.com\/wp-content\/uploads\/2021\/12\/save-engines-300x163.png 300w\" alt=\"Click the Save Engines button\" width=\"680\" height=\"369\" data-ll-status=\"loaded\" \/><\/figure>\n<p>SearchWP will now index your content, PDF metadata, custom fields metadata, images, files, and other types of metadata to include in WordPress search.<\/p>\n<p>You\u2019ll be able to see the \u2018Index Status\u2019 in the right corner and view how many items the plugin has indexed.<\/p>\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-107771 lazyloaded\" title=\"SearchWP index status\" src=\"https:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2021\/12\/searchwp-index-status.png\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" srcset=\"https:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2021\/12\/searchwp-index-status.png 680w, https:\/\/cdn4.wpbeginner.com\/wp-content\/uploads\/2021\/12\/searchwp-index-status-300x127.png 300w\" alt=\"SearchWP index status\" width=\"680\" height=\"288\" data-ll-status=\"loaded\" \/><\/figure>\n<p>Besides that, SearchWP also offers other customization settings.<\/p>\n<p>For instance, if you go to the \u2018Settings\u2019 tab, then you can add stopwords and synonyms to be ignored during the search process to improve relevancy and\u00a0performance.<\/p>\n<p>The plugin will already have a list by default, but you can add more stopwords if you want. Similarly, you can add synonyms for search terms that you want to ignore while searching.<\/p>\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-107609 lazyloaded\" title=\"Add stopwords in settings\" src=\"https:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2021\/12\/add-stopwords-in-settings.png\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" srcset=\"https:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2021\/12\/add-stopwords-in-settings.png 680w, https:\/\/cdn2.wpbeginner.com\/wp-content\/uploads\/2021\/12\/add-stopwords-in-settings-300x109.png 300w\" alt=\"Add stopwords in settings\" width=\"680\" height=\"248\" data-ll-status=\"loaded\" \/><\/figure>\n<p>Next, you can edit more settings by going to the \u2018Advanced\u2019 tab.<\/p>\n<p>For example, the plugin lets you enable the option to show partial matches when search terms show no result, limit results to exact matches when double quotes are used, remove minimum word length, and more.<\/p>\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-107772 lazyloaded\" title=\"SearchWP Advanced Settings\" src=\"https:\/\/cdn.wpbeginner.com\/wp-content\/uploads\/2021\/12\/searchwp-advanced-actions-and-settings.png\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" srcset=\"https:\/\/cdn.wpbeginner.com\/wp-content\/uploads\/2021\/12\/searchwp-advanced-actions-and-settings.png 680w, https:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2021\/12\/searchwp-advanced-actions-and-settings-300x150.png 300w\" alt=\"SearchWP Advanced Settings\" width=\"680\" height=\"338\" data-ll-status=\"loaded\" \/><\/figure>\n<p>Now, if you want to see the search history and see which queries your users search the most, then head over to the \u2018Statistics\u2019 tab.<\/p>\n<p>The plugin will give all the stats about your WordPress search from the past 30 days or the last 1 year. You can use this data to see which queries your users search while on your site and come up with new content ideas.<\/p>\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-107649 lazyloaded\" title=\"View search stats\" src=\"https:\/\/cdn2.wpbeginner.com\/wp-content\/uploads\/2021\/12\/view-search-stats-1.png\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" srcset=\"https:\/\/cdn2.wpbeginner.com\/wp-content\/uploads\/2021\/12\/view-search-stats-1.png 680w, https:\/\/cdn2.wpbeginner.com\/wp-content\/uploads\/2021\/12\/view-search-stats-1-300x159.png 300w\" alt=\"View search stats\" width=\"680\" height=\"360\" data-ll-status=\"loaded\" \/><\/figure>\n<p>We hope this article helped you learn how to make custom fields searchable in WordPress. You may also want to look at our guide on\u00a0how to register a domain name\u00a0and the\u00a0best WordPress plugins for business sites.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Do you want your visitors to easily search custom fields to find <a class=\"read-more\" href=\"https:\/\/rengga.dev\/blog\/how-to-make-custom-fields-searchable-in-wordpress\/\" title=\"How to Make Custom Fields Searchable in WordPress\" itemprop=\"url\"><\/a><\/p>\n","protected":false},"author":1,"featured_media":3785,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[134,141,119,136],"newstopic":[650,595],"class_list":{"0":"post-2667","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-wordpress","8":"tag-categories-wordpress","9":"tag-custom-fields-searchable","10":"tag-design-tips","11":"tag-wordpress-plugin","12":"newstopic-plugin","13":"newstopic-wordpress"},"_links":{"self":[{"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/posts\/2667","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/comments?post=2667"}],"version-history":[{"count":1,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/posts\/2667\/revisions"}],"predecessor-version":[{"id":2669,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/posts\/2667\/revisions\/2669"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/media\/3785"}],"wp:attachment":[{"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/media?parent=2667"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/categories?post=2667"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/tags?post=2667"},{"taxonomy":"newstopic","embeddable":true,"href":"https:\/\/rengga.dev\/blog\/wp-json\/wp\/v2\/newstopic?post=2667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}