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

Wie man die Google-Suche in eine WordPress-Website einfügt (der einfache Weg)

Hinweis der Redaktion: Wir erhalten eine Provision für Partnerlinks auf WPBeginner. Die Provisionen haben keinen Einfluss auf die Meinung oder Bewertung unserer Redakteure. Erfahre mehr über Redaktioneller Prozess.

Möchten Sie die Google-Suche auf Ihrer WordPress-Website verwenden?

WordPress verfügt standardmäßig über eine integrierte Suchfunktion, die jedoch nicht sehr gut ist. Wenn Sie stattdessen die Google-Suche hinzufügen, können Sie den Besuchern genauere und relevantere Suchergebnisse anzeigen.

In diesem Artikel zeigen wir Ihnen, wie Sie die Google-Suche ganz einfach zu einer WordPress-Website hinzufügen können.

Add Google Search in a WordPress Site

Warum sollten Sie die Google-Suche in WordPress verwenden?

Die standardmäßige WordPress-Suchfunktion ist nicht sehr nützlich und findet oft keine relevanten Ergebnisse für Benutzeranfragen. Dies zwingt viele Website-Besitzer dazu, nach Alternativen zu suchen.

Sie können ein beliebtes WordPress-Such-Plugin verwenden. Das Problem ist jedoch, dass Sie dieses Plugin immer noch verwalten müssen und dass es sich auf Ihre Serverressourcen auswirken wird.

Andererseits können Sie stattdessen die zuverlässige und leistungsstarke Suchfunktion von Google verwenden. Sie ist kostenlos, erlaubt es Ihnen, die Suche auf Ihre Websites zu beschränken, und kann von Ihrer WordPress-Website aus ausgeführt werden.

Außerdem ist die Google-Suche schnell, die Nutzer vertrauen der Marke bereits, und Sie müssen sie nicht pflegen oder aktualisieren. Bei Bedarf können Sie den Nutzern sogar erlauben, externe Websites auf Google zu durchsuchen.

Sehen wir uns also an, wie Sie Ihrer WordPress-Website ganz einfach eine Google-Site-Suche hinzufügen können.

Hinzufügen der Google-Suche zu einer WordPress-Website

Sie können die Google-Suche ganz einfach zu Ihrer WordPress-Website hinzufügen, indem Sie die Website der programmierbaren Google-Suchmaschine besuchen.

Klicken Sie hier auf die Schaltfläche „Get Started“.

Click the get started button on the Programmable Search Engine page

Sie werden auf die Seite „Neue Suchmaschine erstellen“ weitergeleitet, wo Sie einen Namen für das Suchformular eingeben müssen, das Sie erstellen möchten.

Wählen Sie dann die Option „Bestimmte Websites oder Seiten suchen“ im Abschnitt „Was soll gesucht werden?“ und fügen Sie die URL Ihrer WordPress-Website hinzu.

Die Googe-Site-Suche indiziert nur den Inhalt Ihrer Website. Wenn Sie jedoch möchten, dass Google auch Suchergebnisse von anderen Websites anzeigt, können Sie die Option „Das gesamte Web durchsuchen“ wählen.

Add website URL to create Google Site search

Scrollen Sie dann nach unten und aktivieren Sie die Option „Bildersuche“, damit Ihr Google-Suchformular die Bilder auf Ihrer Website indizieren kann. Wir empfehlen diese Option, wenn Sie Fotos online verkaufen, eine Fotografie-Website haben oder einen Reiseblog betreiben.

Danach können Sie auch den Schalter „Sichere Suche“ einschalten, damit den Nutzern keine ungeeigneten Ergebnisse für ihre Suchanfragen angezeigt werden.

Wenn Sie fertig sind, klicken Sie auf die Schaltfläche „Erstellen“.

Click create to generate a google search engine ID

Google wird nun Ihren Suchmaschinen-ID-Code für Sie generieren.

Kopieren Sie den Code und fügen Sie ihn in ein Notizbuch oder einen einfachen Texteditor ein.

Copy the Google Search Engine ID from the website

Nun müssen Sie Ihr WordPress-Dashboard besuchen und Ihre Themendateien bearbeiten, um die Suche in den <body> Ihrer Website einzufügen. Dies kann jedoch riskant sein, und der kleinste Fehler kann Ihre Website zerstören.

Deshalb empfehlen wir stattdessen die Verwendung von WPCode. Es ist das beste WordPress Code Snippets Plugin auf dem Markt, das es sicher und einfach macht, benutzerdefinierten Code hinzuzufügen.

Zunächst müssen Sie das WPCode-Plugin installieren und aktivieren. Detaillierte Anweisungen finden Sie in unserem Leitfaden für Anfänger zur Installation eines WordPress-Plugins.

Hinweis: WPCode hat einen kostenlosen Plan, den Sie für dieses Tutorial verwenden können. Wenn Sie jedoch auf die Pro-Version upgraden, erhalten Sie Zugriff auf weitere Funktionen wie intelligente bedingte Logik, eine Cloud-Bibliothek mit Code-Snippets und mehr.

Rufen Sie nach der Aktivierung die Seite Code-Snippets “ + Snippet hinzufügen in der WordPress-Admin-Seitenleiste auf. Klicken Sie hier auf die Schaltfläche „Snippet verwenden“ unter der Option „Eigenen Code hinzufügen (neues Snippet)“.

Add new snippet

Dies führt Sie zur Seite „Benutzerdefiniertes Snippet erstellen“, wo Sie einen beliebigen Namen für das Snippet eingeben können. Wählen Sie dann „Universal Snippet“ als Codetyp aus dem Dropdown-Menü auf der rechten Seite.

Fügen Sie dann einfach die Google Search Engine ID in das Feld „Code Preview“ ein.

Paste the Google Search Engine ID into WPCode preview box

Scrollen Sie dann nach unten zum Abschnitt „Einfügen“ und wählen Sie den Modus „Automatisch einfügen“. Das Google-Suchformular wird nach der Aktivierung automatisch zu Ihrer Website hinzugefügt.

Danach können Sie das Dropdown-Menü „Standort“ erweitern, um auszuwählen, wo Sie Ihr Suchfeld anzeigen möchten.

Wenn Sie zum Beispiel das Suchformular oben auf allen Seiten und Beiträgen anzeigen möchten, können Sie die Option „Vor dem Beitrag einfügen“ wählen.

Choose location and insertion for the search engine ID

Blättern Sie dann zurück nach oben und schalten Sie den Schalter „Inaktiv“ auf „Aktiv“ um.

Klicken Sie schließlich auf die Schaltfläche „Snippet speichern“, um Ihre Einstellungen zu speichern.

Save Google Search Engine ID snippet

Sie haben erfolgreich ein Google Site-Suchformular manuell hinzugefügt.

Sie können nun Ihr WordPress-Blog besuchen, um es in Aktion zu sehen.

Google Search preview

Alternative: Verwenden Sie SearchWP, um ein beeindruckendes Suchformular zu erstellen

Wenn Sie es schwierig finden, Google Site Search zu Ihrer Website hinzuzufügen oder eine Alternative suchen, können Sie SearchWP für die interne Suche verwenden.

Es ist das beste WordPress-Such-Plugin auf dem Markt, das automatisch das Standard-Suchformular ersetzt und es den Benutzern ermöglicht, alles zu finden, was sie auf Ihrer Website benötigen.

The SearchWP homepage

SearchWP wird von über 30.000 Websites verwendet und ermöglicht Ihnen die Erstellung einer benutzerdefinierten Relevanzskala zur Anpassung des Suchalgorithmus.

Sie können auch jeden Teil Ihrer Website durchsuchbar machen, einschließlich PDFs, benutzerdefinierte Beitragstypen, Medien, Kommentare, benutzerdefinierte Felder, WooCommerce-Produkte und mehr.

Wenn Sie eine mehrsprachige Website haben, dann können Sie mit dem Plugin auch eine mehrsprachige Suche erstellen.

Configure SearchWP engine settings

Sie müssen jedoch bedenken, dass das Plugin im Gegensatz zur Google-Suche nur die auf Ihrer Website verfügbaren Inhalte indizieren und Ergebnisse anzeigen kann.

Weitere Details finden Sie in unserem Tutorial über die Verbesserung der WordPress-Suche mit SearchWP.

Wir hoffen, dass dieser Artikel Ihnen geholfen hat zu erfahren, wie Sie die Google-Suche ganz einfach zu einer WordPress-Website hinzufügen können. Vielleicht interessieren Sie sich auch für unseren Leitfaden für Einsteiger, wie ich meine WordPress-Website bei Google eintragen kann, und unsere Tipps zur Verwendung der Google Search Console, um den Website-Traffic zu erhöhen.

Wenn Ihnen dieser Artikel gefallen hat, dann abonnieren Sie bitte unseren YouTube-Kanal für WordPress-Videotutorials. Sie können uns auch auf Twitter und Facebook finden.

Offenlegung: Unsere Inhalte werden von unseren Lesern unterstützt. Das bedeutet, dass wir möglicherweise eine Provision verdienen, wenn Sie auf einige unserer Links klicken. Mehr dazu erfahren Sie unter Wie WPBeginner finanziert wird , warum das wichtig ist und wie Sie uns unterstützen können. Hier finden Sie unseren redaktionellen Prozess .

Das ultimative WordPress Toolkit

Erhalte KOSTENLOSEN Zugang zu unserem Toolkit - eine Sammlung von WordPress-bezogenen Produkten und Ressourcen, die jeder Profi haben sollte!

Reader Interactions

82 KommentareEine Antwort hinterlassen

  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. Ivo says

    Hi there, thanks for the well-explained method. The only problem I had was after activate and save the snipped I was taken to a page: „403 Forbidden Access to this resource on the server is denied!“. How, I guess I have to do something in my cPanel or have to contact the hosting provider to fix this?
    Regards

  3. Dennis Muthomi says

    Great guide!

    Finding relevant information quickly on a WordPress site can be frustrating with the default search. I’ve been considering integrating either the Google Programmable Search Engine or the SearchWP plugin to improve the search experience for my visitors.

    I’m leaning towards SearchWP for better control over relevancy, but I’m curious if anyone has tips for optimizing its performance on larger sites?

    • WPBeginner Support says

      It would depend on the size of the site, SearchWP has documentation on the plugin’s site for it’s different site size recommendations.

      Admin

    • Jiří Vaněk says

      I have tested SearchWP and can recommend it for larger sites as well. Specifically tested on a website with more than 1300 articles and many categories.

  4. Jiří Vaněk says

    This sounds like a very handy alternative to the classic WordPress search. Does it also have any impact on better indexing of the site?

    • WPBeginner Support says

      Indexing of your content would be handled through things like SEO plugins, these search options would not affect your indexing.

      Admin

  5. Cammy says

    Is there a way to set it up so the search results are served on a custom page of my website – i.e. the search results page or one with my sites header and footer?

    • WPBeginner Support says

      That would depend on your theme. If you reach out to your theme’s support they should be able to assist.

      Admin

  6. Josh says

    How did you get your WordPress search icon via the header to show Google search results? That is actually what I am trying to do and it seems impossible with my scope of skillset. A tutorial would be great but I am sure it wouldn’t be as easy to give a tutorial on something like that. Thank you for this article, though!

    • WPBeginner Support says

      If your theme does not have the option to add a search widget to your header, you would want to reach out to your theme’s support for hot to add it to your specific theme.

      Admin

      • Josh says

        I actually figured it out 10 minutes after sending my comment, of course. It involved two things of code from Google. One code replaced what was in my searchform.php file while placing the other code on the search results page. Super easy, but now I just have to customize the looks so that it looks better with my theme.

        Thanks and regards,

        J

  7. Ruhul Mashbu says

    When I insert the google engine id the plugin automatically creates a page where the search result will be displayed. But what I need is to change the link of the page where the search result will be displayed. How can I do that?

  8. Yohan Perera says

    I am using the WP Google Search Plugin. I was so frustrated because I couldn’t get the search icon show. Your tip on customizing the search box through the dashboard in Google Custom Search solved the problem.

  9. Graham FB says

    Cool artricle but what I wanted to have a the custom search box in the centre of a blank page as if it was a google search page. I found the plugin Blank Slate which gives the blank page just not sure how to either center and limit the width of the search box either by code or shortcode any ideas ??

  10. Saurabh Saneja says

    Thanks wpbeginner your articles have always helped me a lot. I wanted to do it manually because that way wherever I have search form it’ll be replace by custom google search and your article did work for me as always :)

    When i tried it first it didn’t work because I registered website as http(s) or didn’t enclose the code within a div so it really gave e a hard time. Anyway i am all thanks for your help!!

    Thanks again :)

  11. Craig says

    It works exactly how I want it to, searching 2 different web sites, as long as I am logged into WP Admin. Once I’m no longer logged in to the WP Admin I get

    Not Found
    Apologies, but the page you requested could not be found. Perhaps searching will help.

    What step did I miss?

    • Dibyandu Pal says

      I don’t have much idea about web designing and further customizing. I am learning wordpress blogging from last 5 months, and I think it may be due to a problem while publishing your search result page. There is a visibility option in edit page mode. If that page is private or password protected, this problem you said may arise. If it is done so, make it public..

  12. Shri says

    Plugin method works well for me. But I am trying to replace theme’s native menu bar search functionality with CSE. Its wordpress native search only. So manual editing searchform.php method should work for me.
    But after editing searchform.php my search widget vanishes from sidebar. I am using Colormag theme by themegrill.
    Looking out for a help.

    I am also keen to see mentioned in above comment but this site is offline now. I tried to fetch it from wayback machine but couldn’t found in its past impressions.

    • Dana says

      The same thing happens to me when I paste that code into searchform.php. Not sure this is proper as searchform.php by default is an HTML form. The code copied from Custom Google Search is a JavaScript tag…. should this even work??

  13. Waleed Younas says

    Really Helpful topic as always.

    I am using a Plugin in my Site. How can I exclude ads from Search Results

  14. Jackson says

    Hi Wpbeginner,

    This worked like charm! The manual method is just as awesome as you wrote. Google custom search now showing on my site!

    Thank you so much.

  15. Claire Brotherton says

    Can you only implement custom search when the site is live and indexed by Google? If it’s hidden or password protected, can it be added then?

  16. Susanna says

    I am trying to add Google Search with the Plugin to my website. I got as far as the step where I am supposed to paste the search engine ID into the WP Google Search’s settings page. My settings page does not seem to have any place where I can do this. Can you tell me where the ID should be pasted and what it is called?

    Thanks.

  17. fdecicco says

    the manual way of doing this is poorly described and a total waste of time. If you gonna do something do it right ir dont do it at all.

    • WPBeginner Support says

      If you are having difficulty using the manual method, then please try the first method. It is easier to add Google Search with the help of a plugin. If you need to do it manually, then please let us know which part isn’t clear and we will try to explain it here.

      Admin

  18. phil davis says

    By using this search plug-in will I be able to see a report on what words were typed in the box to search for?

    I want to know what people are searching for, so I can create content based on their search.

  19. Ameer Shaik says

    I have updated through plugin method. Only search button is not displayed properly. Please suggest(The text „Search“ is moved down, only top portion is visible). Pl suggest

  20. Jennifer says

    Another awesome tutorial – I didn’t even know it was possible to use Google Search like this! I’ve now got this running on my website, thanks so much!

  21. Imran Khan says

    Nice post, very helpful as well as easily understandable. I have also created my custom search bar by following your steps. Thanks for sharing this great post with us.

  22. Eric Kazda says

    Can somebody tell me why this is a more beneficial search than using the standard WordPress search form? Are there SEO implications? I’m just not sure why anyone would use this over the standard search.

    • Adam Connell says

      I generally find that whenever I search a website for a topic, and it’s using WordPress default search – I’ll get VERY poor results.

      They’ll lack relevance.

      By using Google’s custom search, you won’t get any SEO benefits but your readers will find it easier to get what they’re looking for.

  23. Priti says

    In „Search by Google“ how to we specify the our google search id ? In widget don’t we have to keep the google search engine id?

  24. Carol Long says

    Hi – can you tel me please how to remove this? I have just seen it appear on all my pages and I don’t want it at all!

    Many thanks

  25. Richard Bishop says

    Hello, and thank you for creating this post and video. I really found it to be helpful in terms of providing better search results for my site WarCraft Press.

    I would however say that you should have pointed out at the beginning of the lesson there are 2 ways to accomplish this task. I did it once with out the plugin then later realized there was a plugin for it.

    That said thanks again for a great lesson and I certainly look forward to future lessons!

    Kombear
    WarCraft Press

  26. cowboy Mike says

    Howdy,
    I have seen you recommend editing wp files and wp theme template files like you have in this article for the searchform.php file.

    My concern is when there is a theme update or wordpress update wouldnt the changes to the searchform.php suggested here be lost after for example a theme update?

    Happy trails, Mike

  27. Shahadat Hossain says

    can i use google custom search box and wp normal box all together in my site. or i will have to use only one search box between two of this search box

  28. Nasser says

    How to make a search bar that join to google? Not just a small windows as Custom google search. Exactly work as google search.
    Thanks.

  29. Ramesh Tatipigari says

    Hi ,

    I want to add google search bar to every post of my wordpress site or i want to add google search bar to below main menu could you please help me regarding this.

  30. Javed Ahmadzai says

    Well, I have done the same procedure. my theme does not contain searchform.php i created it but it contain searchresults.php i think its theme’s search. but after creating the searchform.php and pasting the code there. another search widget not appeared. Only sahifa search which is theme’s so please can you tell me what the problem. :(

  31. Raghu says

    Hi, I would like to know if I can use google custom search for my intranet portal. I have setup wikipedia for internal purpose and I would like to integrate google custom search for this, however I am not getting result when I integrate.
    So the question is: Is google custom search meant only for public websites?

  32. Chris says

    Hi, I went through these steps exactly for my WordPress site, but the search box doesn’t appear anywhere. There are no .js errors in the console. I put a border around the containing div and the border appears, but there’s nothing inside it. I pasted the code I generated from Google inside searchform.php. As a test I also tried pasting the google code on a test page, but still no luck.

    Any ideas on troubleshooting?

  33. Deepak Singh says

    Can you please guide me how we cana dd Custom Search in genesis child theme. I tried many tutorials but none of them work.

  34. Joy Baker says

    Forgive my newbie status, but when pasting the code into the search.php of my theme’s search page, do I replace the code in the page with Google’s code? I am an idiot when it comes to php code. I know what it looks like, what the opening/closing tags look like, but I have no idea what you mean when you say paste the code in the page.

    Where? Replace it all or between the opening/closing tags or… ???

    Current code looks like this:


    So, do I replace the entire code in the page with the custom Google Search I’ve created?
    Google code:


    Thanks for any help you can give.

Eine Antwort hinterlassen

Danke, dass du einen Kommentar hinterlassen möchtest. Bitte beachte, dass alle Kommentare nach unseren kommentarpolitik moderiert werden und deine E-Mail-Adresse NICHT veröffentlicht wird. Bitte verwende KEINE Schlüsselwörter im Namensfeld. Lass uns ein persönliches und sinnvolles Gespräch führen.