0

I have a question about how actions and filters interact with functions:

I am currently using an event ticketing plugin for wordpress, there are built in validation rules that is already in the plugin (i.e. fields are all completed, number fields contain integers etc.). I want to write a function that 'extends' the existing plugin function. When I write my functions, does the existing plugin function for that hook still apply? Or would I have to copy over parts of that function I want to retain into my new one? Or does wordpress run both functions in some kind of sequence?

If I wanted to write a validation that is the opposite of what is currently in the plugin function (i.e. number fields should contain an alphabetical character) how does a custom function overwrite a part of an existing function? Would I have to remove those lines in the plugin file itself?

Thanks in advance.

0

It depends entirely on the specific plugin and the specific hook. It's completely up to plugin developers what they want to allow other developers to do. They could allow developers to replace entire functions; to perform a custom action at the beginning, middle, or end of a function; to modify the result of a function; or none of the above. It's impossible to give a generic answer.

The only way to know what you can do is to consult the developer documentation for the plugin, which will tell you what you can do. If that doesn't exist, reading the actual code of the plugin and looking for hooks is all you can do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.