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.
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.
Share Improve this question asked Aug 13, 2019 at 2:06 machumpmachump 1237 bronze badges1 Answer
Reset to default 0It 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.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745247610a4618483.html
评论列表(0条)