Skip to content
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

The plugin doesn't check if a function can be overridden or not and throw an error #123

Open
kalonya opened this issue Feb 21, 2022 · 3 comments
Labels

Comments

@kalonya
Copy link

kalonya commented Feb 21, 2022

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.

CleanShot 2022-02-21 at 14 57 46@2x

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.

@mxdpeep
Copy link

mxdpeep commented May 7, 2022

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. 😎

@sheabunge
Copy link
Member

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?

@mxdpeep
Copy link

mxdpeep commented Jul 6, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants