{"id":6515,"date":"2022-09-27T18:47:18","date_gmt":"2022-09-27T16:47:18","guid":{"rendered":"https:\/\/mainetcare.de\/?post_type=techdoc&#038;p=6515"},"modified":"2026-07-14T11:35:16","modified_gmt":"2026-07-14T09:35:16","slug":"how-to-search-for-specific-content-types-only-with-the-elementor-search-form","status":"publish","type":"gartenschuppen","link":"https:\/\/mainetcare.de\/en\/gartenschuppen\/wie-kann-man-mit-dem-elementor-suchformular-nur-nach-bestimmten-inhaltstypen-suchen\/","title":{"rendered":"How can I use the Elementor search form to search for specific content types only?"},"content":{"rendered":"<p>Elementor Pro besitzt ein Widget namens &#8220;Suchformular&#8221;. Dieses eignet sich f\u00fcr die h\u00fcbsche Gestaltung von Suchformularen. In der Programmatik ist dieses Suchformular leider beschr\u00e4nkt.<\/p>\n<p><strong>Frage:<\/strong> Wie kann man das Elementor Suchformular so modifizieren, dass man die Suche auf bestimmte Inhaltstypen einschr\u00e4nkt (z.B. nur nach Posts, Pages, Products, FAQ, &#8230; suchen)?<\/p>\n<p><strong>Antwort \/ L\u00f6sung:<\/strong><\/p>\n<ol>\n<li>Dem Widget eine eindeutige ID gebeb, z.B. <strong>mnc_search_posts<\/strong><\/li>\n<li>In functions.php folgenden Code einf\u00fcgen:\n<pre>add_action( 'elementor_pro\/search_form\/after_input', function( \\ElementorPro\\Modules\\ThemeElements\\Widgets\\Search_Form $form ) {\r\n   if($form-&gt;get_settings()['_element_id'] ?? null  === '<strong>mnc_search_posts<\/strong>') {\r\n      echo '&lt;input type=\"hidden\" name=\"post_type\" value=\"post\" \/&gt;';\r\n   }\r\n}, 10, 1 );<\/pre>\n<\/li>\n<\/ol>\n","protected":false},"featured_media":0,"template":"","meta":{"_acf_changed":false},"class_list":["post-6515","gartenschuppen","type-gartenschuppen","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/mainetcare.de\/en\/wp-json\/wp\/v2\/gartenschuppen\/6515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mainetcare.de\/en\/wp-json\/wp\/v2\/gartenschuppen"}],"about":[{"href":"https:\/\/mainetcare.de\/en\/wp-json\/wp\/v2\/types\/gartenschuppen"}],"wp:attachment":[{"href":"https:\/\/mainetcare.de\/en\/wp-json\/wp\/v2\/media?parent=6515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}