WordPress add_filter ucwords callback function notice

wordpress

#1

I just wonder, why I am getting notice when I use ucwords as a callback function in add_filter

Notice: Use of undefined constant ucwords - assumed 'ucwords' in...

However, it is updating the content with capitalization.

WP_DEBUG is set to true


#2

Because you didn’t quoted the callback function. It should be add_filter(‘whatever’, ‘ucwords’) not add_filter(‘whatever’, ucwords);


#3

Thanks for the quick response.

Yes, I am pretty much aware of it. This is just I got when I was following Jeffry’s tutorial. He too added without the quote. His WP_DEBUG must be false.