Title: Using Code from header.php
Last modified: June 21, 2024

---

# Using Code from header.php

 *  Resolved [meike297](https://wordpress.org/support/users/meike297/)
 * (@meike297)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/using-code-from-header-php/)
 * Hello, I use a code from GetyourGuide to track my affiliate link bookings. This
   code is inserted into the header.php according to the instructions from GetyourGuide.
   This also works, but unfortunately there is the problem that every time my theme
   is automatically updated, this code will be removed from the header.php. Unfortunately,
   all the widgets then disappear and I have to insert the code again and again.
   That’s why I would like to use your plugin. Can you please confirm whether this
   will work? The code would be as follows:
 *     ```wp-block-code
       <!-- GetYourGuide Analytics --><script async defer src="https://widget.getyourguide.com/dist/pa.umd.production.min.js" data-gyg-partner-id="HDP3ELY"></script>
       ```
   
 * Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/using-code-from-header-php/#post-17842127)
 * Sure, you can add this as a **Content** snippet and set to ‘display in site head’.
 *  Thread Starter [meike297](https://wordpress.org/support/users/meike297/)
 * (@meike297)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/using-code-from-header-php/#post-17845709)
 * Thank You but I don’t find This Settings. I only can put this code above and 
   Set „type PHP“?
 *  [generosus](https://wordpress.org/support/users/generosus/)
 * (@generosus)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/using-code-from-header-php/#post-17846579)
 * Hey [@meike297](https://wordpress.org/support/users/meike297/),
 * You need to explore the plugin in more detail to understand how it works and 
   what [@bungeshea](https://wordpress.org/support/users/bungeshea/) shared with
   you.
 * In short, one of the following will solve your issue:
    1. Go the **Content (HTML)** tab and create a code snippet that looks [like this](https://prnt.sc/VPdWEvBImOu_).
    2. Go the **Functions (PHP)** tab and create a code snippet as shown below.
 *     ```wp-block-code
       function wp_widget() {?><script type="text/javascript" async defer src="https://widget.getyourguide.com/dist/pa.umd.production.min.js" data-gyg-partner-id="HDP3ELY"></script><?php}add_action('wp_head', 'wp_widget');
       ```
   
 * **Important:** If you theme is deleting your HTML (header) code every time the
   theme is updated, then there’s something wrong with your theme. The theme developers
   need to fix that. Our theme does not do that. Highly recommend contacting them.
 * Cheers 🙂
 *  Thread Starter [meike297](https://wordpress.org/support/users/meike297/)
 * (@meike297)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/using-code-from-header-php/#post-17855623)
 * Hello! Thank you! Yeah I contacted them already and they didnt say nothing about
   that. Just that I need a plugin for it. Thank you for your help, I will try this
   and maybe contact you again. Best regards, Meike

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Using Code from header.php’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [meike297](https://wordpress.org/support/users/meike297/)
 * Last activity: [1 year, 11 months ago](https://wordpress.org/support/topic/using-code-from-header-php/#post-17855623)
 * Status: resolved