-
Notifications
You must be signed in to change notification settings - Fork 107
The plugin doesn't check if a function can be overridden or not and throw an error #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I honestly think that the core use case of this plugin is not to override existing functions, but to add extra PHP handlers and IIFE JavaScript function calls. 😎 |
While @mxdpeep is correct that this seems to be the more common usage, it would definitely be good to have support for pluggable functions. Currently the duplicate checker checks any functions defined in the snippet against those that already exist. I'm trying to think of a way to detect whether those are pluggable or not. Maybe we could add a manual override to disable the duplicate checker for specific functions/snippets? |
manual override switch looks like a promising solution
…On Tue, Jul 5, 2022 at 11:29 AM Shea Bunge ***@***.***> wrote:
While @mxdpeep <https://github.com/mxdpeep> is correct that this seems to
be the more common usage, it would definitely be good to have support for
pluggable functions. Currently the duplicate checker checks any functions
defined in the snippet against those that already exist. I'm trying to
think of a way to detect whether those are pluggable or not. Maybe we could
add a manual override to disable the duplicate checker for specific
functions/snippets?
—
Reply to this email directly, view it on GitHub
<#123 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAASMXTNVBAH2KXY224AQQDVSP6AZANCNFSM5O6MMZPA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I see that differently and would "vote" for a way to also use it for overriding functions, even with a "manual override switch" (whatever that may look like?) There are cases especially with "some" clients where the "Code Snippets" plugin may the last ressort to have a chance to do something like that. |
If there is already a function wrapped by
if(!function_exists('function_name')) {}
, you can't override it via the plugin because it throws the error below.But you can safely override that function with the same code used in the plugin with the functions.php file of the child theme without an error. Those kinds of functions should be overridden safely.
The text was updated successfully, but these errors were encountered: