user7342926
user7342926

Reputation:

WP action hook prefix in php class

Hi I'm currently writing my first Wordpress Plugin in OOP way. I have question about naming class methods that will be used in add_action or add_filter. Does calling it array($this, 'my-action-method) will suffice to avoid naming collisions or I have to add some prefix?

Upvotes: 0

Views: 115

Answers (1)

TurtleTread
TurtleTread

Reputation: 1314

Since you are using $this, it points to the instantiated object. The method name is just be the object (class) method name. There wouldn't be name collision issues (other than within the object/class itself for which PHP should throw an error).

Upvotes: 1

Related Questions