2 min read

How to Add Custom Code to the <head> with Elementor Free (No Pro Needed)

Table of Contents

If you’re using the free version of Elementor, you’ve probably noticed it doesn’t allow you to add custom code to the <head> section of your pages—unless you upgrade to Elementor Pro.

But that’s not true. There’s a simple workaround that doesn’t require any extra plugins or paid upgrades.


✅ The Workaround: Use Your Theme’s functions.php

Most WordPress themes allow you to add custom code via the functions.php file. Here’s how to inject code into the <head> of every page:

1. Access functions.php

  • In your WordPress dashboard, go to: Appearance > Theme File Editor
  • Open the functions.php file.

2. Add Your Code Snippet

Insert the following PHP snippet at the bottom of the file:

function custom_head_code() {
    ?>
    <!-- Your custom head code goes here -->
    <script>
      console.log('Custom code running from the head!');
    </script>
    <?php
}
add_action('wp_head', 'custom_head_code');

Replace the placeholder code with any script, meta tag, or tracking pixel you want to include.

3. Save the File

Click Update File to save your changes. Your custom code will now be injected into the <head> of every page.

With this method, you can stay on the free version of Elementor and still modify the head.

Bonus Tip: Use a Child Theme

Editing your main theme’s functions.php file directly can cause issues. Specifically, it can get overridden when you update your theme. To avoid this, I recommend using a child theme.

Need help inserting tracking codes or custom scripts? Send me a message and I’d be happy to help.