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?
Tell me more
×
WordPress Answers is a question and answer site for
WordPress developers and administrators. It's 100% free, no registration required.
|
|
No that's impossible. When WordPress calls a method it has to be public public. You could write a public method that is called on the hook which calls a private method inside. |
|||||
|
|
Here is an example;
In this example I am filtering You don't need to use static methods by the way, some recommend against it, but do as you please. |
|||||||
|