How to trigger a hook action when loading a title in a Wordpress blog?

Troubleshooting errors in the error plugin. I want to create some errors or good posts when uploading headlines to a WordPress blog site.

as:

if(is header load)
{
  //run a action hook here
  //print success or error msgs through hook function
}

Suggest a hook action to display messages when loading a header.

+3
source share
2 answers

The code below may help. You can put this code in the functions.php file in the theme folder.

                function load_me_on_header()
            {
               // do something here ... like show error message.
            }

            add_action('wp_head','load_me_on_header');
+6
source

You can also use the add_filter () function in the same way. Filters are more convenient when processing content.

+1
source

All Articles