我正在开发一个插件,修改帖子用于搜索引擎优化目的,但展出。
无论如何,我的插件检查了useragent& ip然后匹配谁是搜索引擎等,然后通过正则表达式删除链接等来编辑帖子/页面内容。
如果在显示帖子时编辑帖子有什么问题?所以,当页面是caleld时,我如何编辑内容?
答案 0 :(得分:4)
为了在显示之前更改帖子,请使用Filter Hook content_edit_pre
add_filter('content_edit_pre','your_callback_function');
function your_callback_function(){
// implement your changes here
}
访问http://codex.wordpress.org/Plugin_API/Filter_Reference/content_edit_pre