最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - How to manipulate the content within wp_head

programmeradmin3浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论