在Wordpress博客中加载标头时如何运行钩子动作? [英] How to run a hook action when header load in wordpress blog?

查看:79
本文介绍了在Wordpress博客中加载标头时如何运行钩子动作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用错误插件. 当标头加载到WordPress博客网站中时,我想生成一些错误或成功消息.

Am woking on an error plugin. I want to generate some error or success msgs when header loads in WordPress blog site.

类似于:

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

建议执行挂接操作以在加载标头时显示msgs.

suggest a hook action to display msgs when header load.

推荐答案

下面的代码可能会有所帮助.您可以将此代码放在主题文件夹中的functions.php中.

Below code might help. You can put this code in the functions.php in your theme folder.

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

            add_action('wp_head','load_me_on_header');

这篇关于在Wordpress博客中加载标头时如何运行钩子动作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆