admin管理员组文章数量:1134587
I have difficulties to make this little code compliant with PHP 8 :
add_filter('excerpt_more', create_function('', 'return "";') );
Any idea how to make it working?
I have difficulties to make this little code compliant with PHP 8 :
add_filter('excerpt_more', create_function('', 'return "";') );
Any idea how to make it working?
Share Improve this question edited Oct 7, 2023 at 22:14 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked Oct 7, 2023 at 19:45 Seal20Seal20 32 bronze badges1 Answer
Reset to default 1In general create_function
should be replaced with a closure, like this:
add_filter('excerpt_more', function() {
return "";
});
But in your specific case, you don't even need that. WordPress has you covered already with a built-in function to use in a filter: __return_empty_string()
. So you can just write:
add_filter('excerpt_more', '__return_empty_string' );
本文标签: filtersaddfiltercreatefunction pb in PHP8
版权声明:本文标题:filters - add_filter - create_function pb in PHP8 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736781946a1952646.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论