Support » Fixing WordPress » Can I change the contents of a description meta tag generated by Yoast

  • theJuls

    (@thejuls)


    Essentially I have the Yoast plugin handling my SEO related things. The main one giving problems is the description meta tag.

    The site is bilingual and I would like the description meta tag to be translated as well. Yoast currently does not provide that option, unless I get another plugin which I do not want to get into.

    As it stands, I am told that I can insert the description meta tag through the functions.php using add_action. This unfortunately does not work as it only adds another description meta tag.

    Currently my code looks like this:

    function insert_meta_tag_in_head () {
        echo '<meta name="description" content="My New content" />';
    }
    add_action('wp_head', 'insert_meta_tag_in_head', 1);

    So basically this just gives me a second description meta tag. I have also seen in other threads, that if I want to replace a tag, I should use the do_action function. Which I call as follows:

    do_action('wp_head', 'insert_meta_tag_in_head');

    This however does nothing. What am I doing wrong? How can I change the contents of the description tag given to me through Yoast?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can I change the contents of a description meta tag generated by Yoast’ is closed to new replies.