admin管理员组文章数量:1125747
this maybe a stupid question, when I’m trying to create a custom filter to hook into later and filter and return something, I don’t get any results. I am testing this in the themes functions.php
//value to filter
$message = 'Hello this is a message I want to filter in WP.';
//create my custom filter
apply_filters('message_filter', $message);
add_filter('message_filter', 'change_message');
// define the callback function you mentioned in the above filter function
function change_message($message){
$message = str_replace("Hello","Hi",$message);
return $message;
}
I don't see anything returned in the browser.
本文标签:
版权声明:本文标题:hooks - Adding custom filter not working 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736664569a1946594.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论