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 Kopf- und Fußzeilen-Code in WordPress hinzufü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.

Wurden Sie schon einmal gebeten, einige Codeschnipsel in den <header>- oder <footer>-Abschnitt Ihrer WordPress-Website einzufügen?

Oft werden Sie aufgefordert, Kopf- und Fußzeilencode in WordPress hinzuzufügen, wenn Sie versuchen, sich in Webdienste wie Google Analytics, Google Search Console, Facebook Pixel und andere zu integrieren.

Vielleicht stoßen Sie auch auf WordPress-Tutorials, in denen Sie aufgefordert werden, benutzerdefinierten CSS- oder JavaScript-Code in Ihre WordPress-Kopf- oder Fußzeile einzufügen.

Standardmäßig bietet WordPress keine Option zum Einfügen von Code in die Kopf- und Fußzeile Ihrer Website. Glücklicherweise gibt es eine einfache Lösung für Anfänger.

In diesem Artikel zeigen wir Ihnen, wie Sie einfach Kopf- und Fußzeilencode in WordPress hinzufügen können. Ziel ist es, den Code sicher hinzuzufügen, ohne Ihre WordPress-Theme-Dateien direkt zu bearbeiten.

How to Add Header and Footer Code in WordPress

Der beste Weg, um WordPress Header und Footer Code hinzuzufügen

Wenn Sie den WordPress-Kopf- und Fußzeilencode hinzufügen möchten, gibt es drei mögliche Lösungen:

  1. Manuell, indem Sie die Dateien header.php und footer.php Ihres Themes bearbeiten
  2. Mit der integrierten Kopf- und Fußzeilen-Codefunktion Ihres Themes
  3. Verwendung eines WordPress-Plugins

Die erste Option ist nicht sehr anfängerfreundlich, da Sie den Code für die Kopf- und Fußzeilen direkt in den Dateien header.php und footer.php manuell hinzufügen müssen.

Ein weiterer Nachteil dieser Methode ist, dass Ihr Code entfernt wird, wenn Sie ein Update für Ihr Thema installieren.

Die zweite Möglichkeit ist die Verwendung der integrierten Funktion Ihres Themes. Einige WordPress-Themes wie Elegant Themes und Genesis Framework von StudioPress bieten eine integrierte Option zum schnellen Hinzufügen von Code und Skripten zu Ihrem WordPress-Header und Footer.

Wenn Sie ein Thema mit einer integrierten Funktion verwenden, scheint dies eine sichere und einfache Lösung zu sein. Wenn Sie jedoch Ihr Theme ändern, sind alle Code-Snippets, die Sie Ihrer Website hinzugefügt haben, verschwunden. Dies gilt auch für die Website-Überprüfung in der Google Search Console, die Website-Analyse über Google Analytics und so weiter.

Aus diesem Grund empfehlen wir den Nutzern immer die dritte Option, ein Header- und Footer-Plugin zu verwenden. Diese Option ist bei weitem die einfachste und sicherste Methode, um Kopf- und Fußzeilen-Code in WordPress hinzuzufügen.

Nach vielen Anfragen von Lesern hat unser Team das WPCode-Plugin entwickelt.

WPCode

WPCode (ehemals Insert Headers and Footers) ist ein 100% kostenloses Code Snippet Plugin. Mit ihm können Sie ganz einfach Code in die Kopf- und Fußzeile von WordPress einfügen.

Hier sind einige Vorteile der Verwendung des WPCode-Plugins:

1. Einfach, schnell und gut organisiert: Sie können einfach und schnell Codes zu den Kopf- und Fußzeilen Ihrer Website hinzufügen. Außerdem sorgt es für Ordnung, indem es Ihnen erlaubt, alle Ihre Fußzeilen- und Kopfzeilen-Codes an einem Ort zu speichern.

2. Verhindert Fehler: Die intelligente Code-Snippet-Validierung hilft, Fehler zu vermeiden, die bei der manuellen Bearbeitung Ihrer Themendateien auftreten können.

3. Aktualisieren oder ändern Sie Ihr Theme ohne Sorge: Das Plugin speichert Ihren Header- und Footer-Code an einem separaten Ort, so dass Sie Ihr Theme aktualisieren oder ändern können, ohne sich Sorgen zu machen, dass der Code gelöscht wird.

Neben Header- und Footer-Skripten können Sie mit WPCode auch ganz einfach benutzerdefinierte PHP-, JavaScript-, CSS-, HTML- und Text-Code-Schnipsel einfügen, ohne Ihre Theme-Dateien zu bearbeiten.

Darüber hinaus verfügt WPCode über eine integrierte Snippets-Bibliothek, in der Sie alle nützlichen WordPress-Code-Snippets finden können. So können Sie WordPress-Funktionen, die Sie nicht benötigen, wie automatische Updates, REST API, XML-RPC, Kommentare und mehr, schnell entfernen.

Hinweis: Wenn Sie erweiterte Funktionen wie eine private Cloud-Snippet-Bibliothek, Konvertierungspixel, geplante Snippets, Code-Revisionen und mehr wünschen, können Sie auf WPCode Pro upgraden.

Weitere Einzelheiten finden Sie in unserer Anleitung zum einfachen Hinzufügen von benutzerdefiniertem Code in WordPress.

Sehen wir uns also an, wie man mit dem WPCode-Plugin ganz einfach Kopf- und Fußzeilencode in WordPress hinzufügen kann.

Video-Anleitung

Subscribe to WPBeginner

Wenn Sie sich das Video-Tutorial nicht ansehen möchten, können Sie die Textversion weiter unten lesen:

Hinzufügen von Code zu Kopf- und Fußzeilen in WordPress

Als Erstes müssen Sie das kostenlose WPCode-Plugin installieren und aktivieren. Weitere Einzelheiten finden Sie in unserer Schritt-für-Schritt-Anleitung für die Installation eines WordPress-Plugins.

Sobald das Plugin aktiviert ist, gehen Sie in Ihrem WordPress-Administrationsbereich zu Code Snippets “ Header & Footer. Danach sehen Sie ein Feld „Kopfzeile“, in dem Sie Ihren Code hinzufügen können.

Add code to header and footer with WPCode

Wenn Sie nach unten scrollen, sehen Sie auch ein Feld „Hauptteil“ und ein Feld „Fußzeile“.

Header and footer script boxes WPCode

Fügen Sie den Code einfach in eines der drei Felder ein. Vergessen Sie anschließend nicht, auf die Schaltfläche „Änderungen speichern“ zu klicken, um Ihre Einstellungen zu speichern.

Das Plugin lädt nun automatisch den Code an den entsprechenden Stellen auf Ihrer WordPress-Website.

Sie können jeden Code, den Sie nicht behalten wollen, jederzeit bearbeiten und entfernen.

Sie müssen das Plugin immer installiert und aktiviert lassen. Wenn Sie das Plugin deaktivieren, wird der gesamte benutzerdefinierte Code nicht mehr zu Ihrer Website hinzugefügt.

Wenn Sie das Plugin versehentlich deaktivieren, ist der Code immer noch sicher in Ihrer WordPress-Datenbank gespeichert. Sie können das Plugin einfach neu installieren oder reaktivieren, und der Code wird wieder angezeigt.

Hinweis: Möglicherweise müssen Sie nach dem Speichern der Änderungen den WordPress-Cache leeren, damit der Code korrekt im Frontend Ihrer Website angezeigt wird.

Wir haben festgestellt, dass der Hauptgrund, warum viele Anfänger das WPCode-Plugin verwenden, darin besteht, Google Analytics zu ihrer Website hinzuzufügen. Dafür empfehlen wir eigentlich das kostenlose MonsterInsights-Plugin.

MonsterInsights ist das beste Google-Analytics-Plugin für WordPress. Es hilft Ihnen, das Google Analytics Tracking mit nur wenigen Klicks einzurichten und zeigt Ihnen hilfreiche Statistiken direkt in Ihrem WordPress Dashboard.

Eine schrittweise Anleitung finden Sie in diesem Tutorial zur Installation von Google Analytics in WordPress.

Wir hoffen, dass dieser Artikel Ihnen geholfen hat, zu lernen, wie man Kopf- und Fußzeilen-Code in WordPress einfach hinzufügen kann. Vielleicht interessiert Sie auch unser Vergleich der besten E-Mail-Marketing-Services und der besten Business-Telefon-Services.

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 .

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

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

264 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. Jiří Vaněk says

    I’ve been using the WpCode plugin for several years and it’s really great. Especially for newbies who are afraid to insert codes into the website. This plugin is almost a must on every website. It can really save a lot of work and here on wpbeginner there are a lot of ready-made solutions.

  3. Pierre-Yves says

    Hello
    I’ve installed the WPCode plugin and I’ve inserted code in the header field in the „Global Header and Footer“ tab. This code shows a popup.
    The website is multisite and WPCode is activated on all the network.
    The popup shows well in the home page of my website, but not on other pages where people can land after searching in Google.
    What I’ve to do to get the popup showing on any page ?
    Thanks

    • WPBeginner Support says

      Just to be certain, does your theme have a style for your other pages that uses a different header or removes the header?

      Admin

  4. Aamir Nadeem says

    How many codes we can add in single header or footer section, I mean can i use two or three codes in single header section like facebook code google code etc.

    • WPBeginner Support says

      As long as the code is added properly and you’re not placing code within other blocks of code you can add as many as you would like.

      Admin

  5. FRANK Pirrone says

    Hello, I added the code and clicked save. Nothing happened. Is there a publish button I need to press?

    • WPBeginner Support says

      It would depend on the code you added as not all code has a visible component, you may also want to try clearing any caching on your site for another common reason for not seeing any change on a site.

      Admin

  6. Jamie Turner says

    Hi — Quick question. I’ve installed the plugin. Is there a way to select which pages the header and footer show up on? All I see is a global install without the ability to select pages. Thanks!

    • WPBeginner Support says

      At the moment the plugin is for adding code to your site’s header and not showing/hiding your header. Your theme’s templates would decide where your header and footer show on your site.

      Admin

  7. Pierre Patenaude says

    I have installed the plugin (and it shows as being activated in the plugin list) but it doesn’t show up in the „Settings“ menu. Did I miss a step? Could you provide a solution?
    Thanks

    • WPBeginner Support says

      No, the option should be available once the plugin is active as long as you have access to edit the site’s settings, you would want to ensure you are an admin on the site and if it is still not visible you would want to try disabling your other plugins to see if it is possibly a conflict with one of those plugins.

      Admin

  8. Ashleigh White says

    Hi! I have a question! I am trying to add the global site tag and phone snippet to my code on each page so I can track my google ad calls. I have the „Headers and Footers“ plugin, can I just paste it here and I am good? Or does it matter where I post it (Header vs. Body. Footer)? Thanks so much!

  9. Deborah Dakota says

    So close to being what’s needed! But Google strongly recommends using different metadata for every page. „Identical or similar descriptions on every page of a site aren’t helpful when individual pages appear in the web results. In these cases we’re less likely to display the boilerplate text. Wherever possible, create descriptions that accurately describe the specific page. “ Please consider updating your plugin accordingly.

    • WPBeginner Support says

      Our plugin is not for metadata, it is mainly for code to add things like Google Analytics tracking or for verification codes. If you want a plugin for adding metadata to individual posts, we would recommend taking a look at All in One SEO as that will give you far better control over your metadata :)

      Admin

  10. Robert Zou says

    I have a question. How do you remove code that you added using the insert headers and footers plugin? When I open up the theme editor I can’t find the code I added using this plugin.

    • WPBeginner Support says

      Code added using the plugin would be removed when removed from the plugin’s settings or the plugin is uninstalled.

      Admin

  11. James says

    Hello, hey I added the plugin above to my site and added the code to the header section. Then I tested with your site and it said it was saved successfully.

    But I don’t see the bot when I go to the live site. Could u tell me what I’m doing worng? Tnx.

    • WPBeginner Support says

      It would depend on the specific code you are adding, we would recommend checking with the support for the code for if you added it correctly as not all code is made to have something visible.

      Admin

  12. Emmanuel says

    I wanted to change the color of my address bar using this plugin but each time I paste it gives me an error message

    Is my code okay?

    • WPBeginner Support says

      It would depend on the specific code and where the code is intended to be added. You would want to reach out to who you received the code from for where it should be placed.

      Admin

  13. Elizabeth says

    I bought a theme but it does not let me add any button action in the header nor in the menu, do you think this plugin could help me???

  14. Ahmed says

    How can add the code in the header as high as possible? I need to put Code first of few lines in the header. How can I control the position of the code?

    Thanks

    • WPBeginner Support says

      If you need a very specific location for the code, you would want to manually add the code to your files.

      Admin

  15. William says

    USELESS for a theme that does not have headers in the first place, like wordpress 2021. Useless.

    It was implied that this plugin would do that. It. Does. Not. ALL it does in insert a GIANT version of the picture you choose ABOVE your menu and site name.

    • WPBeginner Support says

      The 2021 theme does have a header but, the Insert Headers and Footers plugin is for inserting code such as Google Analytics, not for adding photos to the header of your website. We would not recommend using this plugin for adding a header image as that would cause the errors you are running into.

      Admin

  16. Muhammad Shoaib says

    Hey There,

    I have already installed „Insert Footer and Header plugin“, if I wanna to remove from site then the inserted code would also be removed from header section or still saved without plugin?
    Kindly light me.

  17. Kirsten says

    I’m being told by Google Analytics to add a Global Site Tag code immediately after the tag. Does this plugin do that? Otherwise, I have no idea how to add this code to *every* page on my site!

  18. Lisa Masquelier says

    Thank you SO much for these simple instructions and the plug-in. I could not figure out why my website kept deleting from Pinterest!

    • WPBeginner Support says

      Code added using the plugin will be on every post and page and not individual codes for individual posts and pages.

      Admin

  19. Trang says

    Hey,

    I can’t find the „Insert Headers“ section below my post’s editor? So how can I enable that function allowing me insert different code for specific post?

  20. Brian Small says

    I am getting the following error when hitting SAVE from this plug-in:

    A potentially unsafe operation has been detected in your request to this site

    • WPBeginner Support says

      You would want to check if you have any security plugins active on your site or if your host has one set up. You may also want to ensure you copied the code you are attempting to add correctly.

      Admin

  21. DAVE says

    On your demonstration you didn’t have anything come up on the top.
    This is the instructions from the code generator I am using;
    Paste the copied code into bottom of your HTML page just before the closing tag
    I tested the code and it does not work, „Am I doing something different? „

    • WPBeginner Support says

      We would first recommend reaching out to the support of what has generated the code to ensure there isn’t anything specific about the code that needs to be set on your page for it to work correctly.

      Admin

  22. James says

    Hello. I need to edit the header code on a specific set of pages only. I have currently added the script I need to the header.php file, however this applies the code to all pages globally.

    Is there any way I can add the script to a specific set of pages only?

    • WPBeginner Support says

      Unless I hear otherwise, we do not have a recommended method for page specific code at this time.

      Admin

  23. Susan says

    Thank you so much!!!

    This stuff scares me as I think I am going to doom my website forever!!

    So easily explained will definitely be subscribing.

    I need to work on this every day.

  24. Marc says

    If my theme does not allow custom header images, will this plugin allow me to make custom header images. Lost on how to do this. We have an old theme with custom header function

  25. Mark says

    Would i be able to use a relative path? so I can move the site to a different host without changing header? if so where is the origin?

    i tried to include some some examples but sucuri blocked the post as malicious. i guess it doesn’t like seeing paths.

  26. Alexandra says

    Yaaaaaaay! I am so excited. I was having so much trouble getting my Mailchimp pop-up to work, but this plugin did the job easy-peasy!

  27. Steve says

    Hi, I have installed the Headers and Footers plugin and added code for the footer. The text that I want displayed is at the very bottom, below the Bento copyright line. Is there a way to have my footer appear at the top of the footer display? Thanks

    • WPBeginner Support says

      For footer customizations, you would want to reach out to your theme’s support to see if they have any recommended options you can use.

      Admin

  28. Subrat says

    I have already put Google analytics code in the header section using insert header and footer plugin how can I add adsense code there again?

    • WPBeginner Support says

      That would be something you can do but not all beginners want to or understand how to create a child theme, that is why we recommend this method.

      Admin

  29. Ruhul says

    This plugin’s activation active auto bulk mail sending from my hosting server. This is working like a spam. So I have to delete this from my website.

    • WPBeginner Support says

      This plugin does not have anything like that, we would recommend scanning your site to ensure you do not have any malicious code on your site

      Admin

  30. Tom says

    I added this plugin to my site but nothing showed when I clicked on the plugin? I’m using an old version of WP but not sure if this is the reason why.

  31. Fazil Ibrahim Moihammed says

    Hi team,

    Does the FB Pixel Base Code was copied and paste on the header tag in that plugin.
    will it automatically apply to every page of the website? Please reply!

  32. Anchal says

    How can I add a code in body section (not in the header/footer section ) with this plugin?
    I want to add certain code in the body section to avoid render blocking.

    • WPBeginner Support says

      The plugin should currently have a third input box where you can include code that should be in the body of your site.

      Admin

  33. Noya says

    Hi,
    My site was built by a web developer who already included all sorts of code snippets in the section of my site.
    If I add new snippets of code using this plugin, will it overwrite the code that’s already there or just add the new code to the existing code?
    I don’t want to make a mess of my site… :-)
    Thanks!

  34. Wendy says

    Hi! I tried to add the plugin to my site but you need to have a business page to add any plugins? Can I add the code without a plugin?

  35. anudeep says

    hi
    First i have install header and footer plugin than after past my google analytics code . but my problem is once past the code and see my website, the code showing disable? How to solve it?

    • WPBeginner Support says

      If the code is not being added to your header, you would want to clear any caching on your site as that is the most common root of that issue.

      Admin

    • WPBeginner Support says

      You would want to check with your specific theme’s support for the header not appearing on a specific page as it could be a page specific template causing you issues.

      Admin

  36. Lio says

    Thanks guys for your plugin! I used it to add FB Pixel to my site, but now I have a landing page and I need a different Pixel event (Lead) on the Thank You page after visitors confirm their details. Can I use the plugin to add the script to a specific page?

  37. Keith says

    Hi, is there a way to change the font size of the footer?
    I tried keying in a chunk of disclaimer text but it is too large.

    Thanks in advance!

    • WPBeginner Support says

      If you mean a WordPress.com site then they currently don’t allow Adsense on their free plan.

      Admin

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.