How can I modify core WordPress actions? (2 posts)

  1. Rob Gabaree
    Posted 7 years ago #

    I know I can remove core WordPress actions via remove_action, but is there a way to modify a core action to perhaps, change it's output? For example, the following action is applied by WordPress via add_action('wp_head', 'noindex', 1);:

    function noindex() {
    // If the blog is not public, tell robots to go away.
    if ( '0' == get_option('blog_public') )
    echo "<meta name='robots' content='noindex,nofollow' />\n";

    Is there a way to modify the echo line in the above function?

  2. Copy the function to your own place and give it a new name, like my_noindex. Then modify it as you like, remove the old action and add your new action.

Topic Closed

This topic has been closed to new replies.

About this Topic