Title: adding script to header?
Last modified: July 29, 2023

---

# adding script to header?

 *  Resolved [rnmartinez](https://wordpress.org/support/users/rnmartinez/)
 * (@rnmartinez)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/adding-script-to-header/)
 * Hi everyone,
 * I am trying to move everything over to the twenty twenty-three theme, but am 
   having an issue with inserting script into the header. Pre-2023, I would have
   inserted my script into the header.php.
 * The script I want is for a GDPR consent; I really don’t want to operate without
   it, but I want to avoid using plugins where possible – I always felt that code
   was a better solution.
 * Any ideas? Can I modify the header.html instead (although it doesn’t really seem
   to be meant to load <script>?)
 * Thanks
 * Rodolfo
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fadding-script-to-header%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Moderator [jordesign](https://wordpress.org/support/users/jordesign/)
 * (@jordesign)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/adding-script-to-header/#post-16933968)
 * Hey [@rnmartinez](https://wordpress.org/support/users/rnmartinez/)
 * In newer block theme’s the html/php isn’t editable directly in the same way. 
   For what it is worth – that is by design, as adding functionality and scripts
   isn’t something really designed to be done directly to the theme.
 * Whilst I understand the desire to minimize plugins – in _this_ case the actual
   best practice would be to install a a plugin that lets you inject the script 
   into the site. That same plugin could be used for additional instance in the 
   future (if you needed to add other things to the <head> of the site).
 * I’d recommend checking out this plugin:
   [https://wordpress.org/plugins/wp-headers-and-footers/](https://wordpress.org/plugins/wp-headers-and-footers/)
 *  Thread Starter [rnmartinez](https://wordpress.org/support/users/rnmartinez/)
 * (@rnmartinez)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/adding-script-to-header/#post-16953635)
 * Thanks – I was hoping that I was missing something here. I just find with these
   plugins they could open potential security holes, degrade performance as they
   upsell or phone home, etc…

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

The topic ‘adding script to header?’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/twentytwentythree/1.6/screenshot.
   png)
 * Twenty Twenty-Three
 * [Support Threads](https://wordpress.org/support/theme/twentytwentythree/)
 * [Active Topics](https://wordpress.org/support/theme/twentytwentythree/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/twentytwentythree/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/twentytwentythree/reviews/)

## Tags

 * [header](https://wordpress.org/support/topic-tag/header/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [script](https://wordpress.org/support/topic-tag/script/)

 * 2 replies
 * 2 participants
 * Last reply from: [rnmartinez](https://wordpress.org/support/users/rnmartinez/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/adding-script-to-header/#post-16953635)
 * Status: resolved