Attach a private function at a hook?

I have a class with some private & public functions. The thing is that I don’t want some of the functions to be able to be called outsite of the class, so I want to make them private. But I need to hook them at particular hooks and the hooks cannot call them if they are private. Is there some workaround for that?

4 Answers
4

No that’s impossible. When WordPress calls a method it has to be public. You could write a public method that is called on the hook which calls a private method inside.
Not sure if that makes sense though …

Leave a Comment