Inserting meta name keywords tags in wordpress for only Post types and not pages

  php, wordpress

I am trying to insert the meta name="keywords" tag in my wordpress posts, But it gets inserted in all the pages starting from home page, which I do not want. I want this inserted into head tag of only Posts. I tried inserting the code in content-single.php file, but it either gets inserted to the top of the page before head tag, or inside the body tag.

<?php echo '<meta name='.'"'.'keywords'.'"'.' content='.'"'.'blogs to read'.'learn japanese'.'"'.'/>'?>

Source: Ask PHP

LEAVE A COMMENT