Add meta tag to header on individual page

Hi,
What would I add to an individual page JS to achive this as used for the whole site?

add_action('wp_head', function(){?>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11"/> 

Thanks!

Hi There @becktowery

Thanks for writing in! You can either use a 3rd party plugin like Insert Headers and Footers or you can utilize your child theme’s functions.php file to insert a meta tag.

First you need to setup a child theme by following this guide (https://theme.co/apex/forum/t/setup-how-to-setup-child-themes/57). Then you can add the following code into your child theme’s functions.php file.

add_action('wp_head','my_custom_meta');
function my_custom_meta() { ?>

<!-- replace this line with your  code here -->

<?php }

In your case, code should looks like:

add_action('wp_head','my_custom_meta');
function my_custom_meta() { ?>

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11"/>

<?php }

Hope that helps.

Yes…I have the functions.php part already. I need to do this for a single, individual page, NOT the whole site. Wondering how to do it on the JS for a unique page.

Hi There @becktowery

If you want to add it to a specific page, try updating your code as follows.

add_action('wp_head','my_custom_meta');
function my_custom_meta() { ?>

  if (is_page( 'contact' )) {
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11"/>
  }

<?php }

You can use page slug or page ID as you can see here (https://developer.wordpress.org/reference/functions/is_page/). You can locate Page/Post IDs by following this guide (https://theme.co/apex/forum/t/setup-how-to-locate-post-ids/59).

Hope that helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.