{"id":45022,"date":"2024-07-25T11:09:13","date_gmt":"2024-07-25T11:09:13","guid":{"rendered":"https:\/\/crocoblock.com\/knowledge-base\/?post_type=article&#038;p=45022"},"modified":"2026-02-24T15:31:28","modified_gmt":"2026-02-24T15:31:28","slug":"how-to-search-posts-by-ids","status":"publish","type":"article","link":"https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-search-posts-by-ids\/","title":{"rendered":"How to Search Posts by IDs"},"content":{"rendered":"\n<p>You can adjust the search to be conducted by post IDs by following the path described in this tutorial.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"add-a-code-snippet\">Add a Code Snippet<\/h2>\n\n\n\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\"><div class=\"wp-block-group__inner-container\">\n<p>Go to <strong><em>WordPress Dashboard &gt;<\/em><\/strong> <strong><em>Snippets &gt; Add New<\/em><\/strong>.<\/p>\n\n\n\n<p>Give the snippet a title. For instance, we have entered \u201cSearch by IDs\u201d in the title field.<\/p>\n\n\n\n<p>Put the following code in the <strong>Code <\/strong>section:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>add_filter( 'jet-search\/ajax-search\/search-by-post-id', '__return_true' );<\/code><\/pre>\n\n\n\n<p>Once done, press the \u201c<strong>Save Changes and Activate<\/strong>\u201d button.<\/p>\n\n\n<div class=\"note-banner d-flex border-bold border-jetthemecore rounded overflow-hidden p-20\"><div class=\"mr-12\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M9 21C9 21.5 9.4 22 10 22H14C14.6 22 15 21.5 15 21V20H9V21ZM12 2C8.1 2 5 5.1 5 9C5 11.4 6.2 13.5 8 14.7V17C8 17.5 8.4 18 9 18H15C15.6 18 16 17.5 16 17V14.7C17.8 13.4 19 11.3 19 9C19 5.1 15.9 2 12 2Z\" fill=\"#F2D23C\"\/><\/svg><\/div><div class=\"d-flex flex-column\"><div class=\"text-900 mb-12\">Things to know<\/div><p class=\"m-0\">Alternatively, this code can be added to the \u201cfunctions.php\u201d file of the active theme.<\/p><\/div><\/div>\n\n\n\n<div class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/add-new-snippet-directory.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"618\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/add-new-snippet-directory-1024x618.png\" alt=\"add new snippet directory\" class=\"wp-image-45023\" srcset=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/add-new-snippet-directory-1024x618.png 1024w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/add-new-snippet-directory-300x181.png 300w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/add-new-snippet-directory-768x463.png 768w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/add-new-snippet-directory-1536x926.png 1536w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/add-new-snippet-directory-600x362.png 600w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/add-new-snippet-directory.png 1824w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/div>\n<\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"add-ajax-search-to-the-page\">Add Ajax Search to the Page<\/h2>\n\n\n\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\"><div class=\"wp-block-group__inner-container\">\n<p>If you haven\u2019t put the search on the needed page\/template, navigate to its editor.<\/p>\n\n\n\n<p>For instance, we go to <strong><em>WordPress Dashboard &gt; Crocoblock &gt; Theme Builder<\/em><\/strong> and press the \u201c<strong>three dots<\/strong>\u201d and \u201c<strong>Edit content<\/strong>\u201d buttons next to the <a href=\"https:\/\/crocoblock.com\/knowledge-base\/jetthemecore\/how-to-create-a-custom-header-with-jetthemecore\/\" target=\"_blank\" rel=\"noreferrer noopener\">built header<\/a>.<\/p>\n\n\n<div class=\"note-banner d-flex border-bold border-jetthemecore rounded overflow-hidden p-20\"><div class=\"mr-12\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M9 21C9 21.5 9.4 22 10 22H14C14.6 22 15 21.5 15 21V20H9V21ZM12 2C8.1 2 5 5.1 5 9C5 11.4 6.2 13.5 8 14.7V17C8 17.5 8.4 18 9 18H15C15.6 18 16 17.5 16 17V14.7C17.8 13.4 19 11.3 19 9C19 5.1 15.9 2 12 2Z\" fill=\"#F2D23C\"\/><\/svg><\/div><div class=\"d-flex flex-column\"><div class=\"text-900 mb-12\">Things to know<\/div><p class=\"m-0\">The provided functionality is accessible if you have the <a href=\"https:\/\/crocoblock.com\/plugins\/jetthemecore\/\">JetThemeCore<\/a> plugin installed and activated. However, it is not required in the described case; you can add <strong>Ajax Search<\/strong> to other pages\/templates built with Elementor, Gutenberg, or Bricks.<\/p><\/div><\/div>\n\n\n\n<div class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/theme-builder-directory.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"618\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/theme-builder-directory-1024x618.png\" alt=\"theme builder directory\" class=\"wp-image-45024\" srcset=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/theme-builder-directory-1024x618.png 1024w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/theme-builder-directory-300x181.png 300w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/theme-builder-directory-768x463.png 768w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/theme-builder-directory-1536x926.png 1536w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/theme-builder-directory-600x362.png 600w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/theme-builder-directory.png 1824w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/div>\n\n\n\n<p>In the opened editor, add the <strong>Ajax Search <\/strong>widget\/block\/element to the page.<\/p>\n\n\n\n<p>Learn more about <a href=\"https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-add-an-ajax-search-to-websites-header-with-jetsearch\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>How to Add an AJAX Search to a Website\u2019s Header<\/strong><\/a>.<\/p>\n\n\n<div class=\"note-banner d-flex border-bold border-jetthemecore rounded overflow-hidden p-20\"><div class=\"mr-12\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M9 21C9 21.5 9.4 22 10 22H14C14.6 22 15 21.5 15 21V20H9V21ZM12 2C8.1 2 5 5.1 5 9C5 11.4 6.2 13.5 8 14.7V17C8 17.5 8.4 18 9 18H15C15.6 18 16 17.5 16 17V14.7C17.8 13.4 19 11.3 19 9C19 5.1 15.9 2 12 2Z\" fill=\"#F2D23C\"\/><\/svg><\/div><div class=\"d-flex flex-column\"><div class=\"text-900 mb-12\">Things to know<\/div><p class=\"m-0\">Also, pay attention to the picked <strong>Source<\/strong> in the <a href=\"https:\/\/crocoblock.com\/knowledge-base\/features\/ajax-search-query-overview\/\">Search Query<\/a> tab as the search will be conducted among the posts of the selected source.<\/p><\/div><\/div>\n\n\n\n<div class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/ajax-search-in-elementor.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"618\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/ajax-search-in-elementor-1024x618.png\" alt=\"ajax search in elementor\" class=\"wp-image-45025\" srcset=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/ajax-search-in-elementor-1024x618.png 1024w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/ajax-search-in-elementor-300x181.png 300w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/ajax-search-in-elementor-768x463.png 768w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/ajax-search-in-elementor-1536x926.png 1536w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/ajax-search-in-elementor-600x362.png 600w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/ajax-search-in-elementor.png 1824w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/div>\n\n\n\n<p>Adjust its settings and click the \u201c<strong>Publish\/Update<\/strong>\u201d button to save the changes.<\/p>\n<\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"check-the-result\">Check the Result<\/h2>\n\n\n\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\"><div class=\"wp-block-group__inner-container\">\n<p>Head to the front end page. In our case, it is the home page, where the search is located in the header.<\/p>\n\n\n\n<p>Complete the search field with any post ID to check if everything works correctly.<\/p>\n\n\n\n<p>Now, we can observe that the results preview shows the needed post.<\/p>\n\n\n\n<div class=\"wp-block-image aligncenter size-large is-resized\"><a href=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/result-on-the-front-end.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"618\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/result-on-the-front-end-1024x618.png\" alt=\"result on the front end\" class=\"wp-image-45026\" style=\"width:840px;height:auto\" srcset=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/result-on-the-front-end-1024x618.png 1024w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/result-on-the-front-end-300x181.png 300w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/result-on-the-front-end-768x463.png 768w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/result-on-the-front-end-1536x926.png 1536w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/result-on-the-front-end-600x362.png 600w, https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/result-on-the-front-end.png 1824w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/div>\n<\/div><\/div>\n\n\n\n<p>That\u2019s all; now you know how to search posts by their IDs with the <strong>Ajax Search <\/strong>widget\/block\/element available with <em>JetSearch <\/em>for WordPress.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Discover how to search posts by their IDs with the Ajax Search from the JetSearch plugin.<\/p>\n","protected":false},"author":9,"featured_media":0,"template":"","format":"standard","builder-category":[],"article-category":[428],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Search Posts by IDs \u2014 JetSearch | Crocoblock<\/title>\n<meta name=\"description\" content=\"Learn how to search posts by IDs with Ajax Search by using the JetSearch plugin for WordPress.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-search-posts-by-ids\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Search Posts by IDs \u2014 JetSearch | Crocoblock\" \/>\n<meta property=\"og:description\" content=\"Learn how to search posts by IDs with Ajax Search by using the JetSearch plugin for WordPress.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-search-posts-by-ids\/\" \/>\n<meta property=\"og:site_name\" content=\"Help Center\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-24T15:31:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/add-new-snippet-directory-1024x618.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-search-posts-by-ids\/\",\"url\":\"https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-search-posts-by-ids\/\",\"name\":\"How to Search Posts by IDs \u2014 JetSearch | Crocoblock\",\"isPartOf\":{\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/#website\"},\"datePublished\":\"2024-07-25T11:09:13+00:00\",\"dateModified\":\"2026-02-24T15:31:28+00:00\",\"description\":\"Learn how to search posts by IDs with Ajax Search by using the JetSearch plugin for WordPress.\",\"breadcrumb\":{\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-search-posts-by-ids\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-search-posts-by-ids\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-search-posts-by-ids\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/crocoblock.com\/knowledge-base\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Articles\",\"item\":\"https:\/\/crocoblock.com\/knowledge-base\/articles\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Search Posts by IDs\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/#website\",\"url\":\"https:\/\/crocoblock.com\/knowledge-base\/\",\"name\":\"Help Center\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/crocoblock.com\/knowledge-base\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/#organization\",\"name\":\"Help Center\",\"url\":\"https:\/\/crocoblock.com\/knowledge-base\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2025\/04\/invert-crocoblock-logo.svg\",\"contentUrl\":\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2025\/04\/invert-crocoblock-logo.svg\",\"caption\":\"Help Center\"},\"image\":{\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Search Posts by IDs \u2014 JetSearch | Crocoblock","description":"Learn how to search posts by IDs with Ajax Search by using the JetSearch plugin for WordPress.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-search-posts-by-ids\/","og_locale":"en_US","og_type":"article","og_title":"How to Search Posts by IDs \u2014 JetSearch | Crocoblock","og_description":"Learn how to search posts by IDs with Ajax Search by using the JetSearch plugin for WordPress.","og_url":"https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-search-posts-by-ids\/","og_site_name":"Help Center","article_modified_time":"2026-02-24T15:31:28+00:00","og_image":[{"url":"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2024\/07\/add-new-snippet-directory-1024x618.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-search-posts-by-ids\/","url":"https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-search-posts-by-ids\/","name":"How to Search Posts by IDs \u2014 JetSearch | Crocoblock","isPartOf":{"@id":"https:\/\/crocoblock.com\/knowledge-base\/#website"},"datePublished":"2024-07-25T11:09:13+00:00","dateModified":"2026-02-24T15:31:28+00:00","description":"Learn how to search posts by IDs with Ajax Search by using the JetSearch plugin for WordPress.","breadcrumb":{"@id":"https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-search-posts-by-ids\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-search-posts-by-ids\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/crocoblock.com\/knowledge-base\/jetsearch\/how-to-search-posts-by-ids\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/crocoblock.com\/knowledge-base\/"},{"@type":"ListItem","position":2,"name":"Articles","item":"https:\/\/crocoblock.com\/knowledge-base\/articles\/"},{"@type":"ListItem","position":3,"name":"How to Search Posts by IDs"}]},{"@type":"WebSite","@id":"https:\/\/crocoblock.com\/knowledge-base\/#website","url":"https:\/\/crocoblock.com\/knowledge-base\/","name":"Help Center","description":"","publisher":{"@id":"https:\/\/crocoblock.com\/knowledge-base\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/crocoblock.com\/knowledge-base\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/crocoblock.com\/knowledge-base\/#organization","name":"Help Center","url":"https:\/\/crocoblock.com\/knowledge-base\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/crocoblock.com\/knowledge-base\/#\/schema\/logo\/image\/","url":"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2025\/04\/invert-crocoblock-logo.svg","contentUrl":"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2025\/04\/invert-crocoblock-logo.svg","caption":"Help Center"},"image":{"@id":"https:\/\/crocoblock.com\/knowledge-base\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/crocoblock.com\/knowledge-base\/wp-json\/wp\/v2\/article\/45022"}],"collection":[{"href":"https:\/\/crocoblock.com\/knowledge-base\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/crocoblock.com\/knowledge-base\/wp-json\/wp\/v2\/types\/article"}],"author":[{"embeddable":true,"href":"https:\/\/crocoblock.com\/knowledge-base\/wp-json\/wp\/v2\/users\/9"}],"wp:attachment":[{"href":"https:\/\/crocoblock.com\/knowledge-base\/wp-json\/wp\/v2\/media?parent=45022"}],"wp:term":[{"taxonomy":"builder-category","embeddable":true,"href":"https:\/\/crocoblock.com\/knowledge-base\/wp-json\/wp\/v2\/builder-category?post=45022"},{"taxonomy":"article-category","embeddable":true,"href":"https:\/\/crocoblock.com\/knowledge-base\/wp-json\/wp\/v2\/article-category?post=45022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}