简体   繁体   中英

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

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

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";
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM