I am looking to create a plugin which will allow me to update content within the wp_head
function. I have the below code which is fine in allowing me to add new content during the wp_head
load event;
<?php
function manipulate_head() {
?>
<title>This is a second title</title>
<?php
}
add_action('wp_head', 'manipulate_head');
However it does not allow me to remove or replace something that is already within the <head>
tags on the page.
An example would be to update the <meta name="description">
tag in the section of the website. The website could have a <meta name="description">
in which case we need to update the content, otherwise we need to add a new one.