How can I add meta data to the head section of the page from a wordpress plugin?

半腔热情 提交于 2019-12-02 04:14:05

问题


I am writing a wordpress plugin and need to add some meta tags to the head section of the page from within my plugin. Does anyone know how I would do this?

Thanks


回答1:


Yes you can add an action hook to wp_head like this:

add_action('wp_head', myCallbackToAddMeta);
function myCallbacktoAddMeta(){
  echo "\t<meta name='keywords' content='$contents' />\n";
}


来源:https://stackoverflow.com/questions/5805888/how-can-i-add-meta-data-to-the-head-section-of-the-page-from-a-wordpress-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!