You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue #40 correctly suggested to get rid of the global variable (globals are always bad and should be avoided at all cost).
However, the proposed solution in turns a single check into three function calls that are processed through major parts of the WordPress system (and, ironically, rely on multiple globals as well).
I better fix would have been to turn the global variable into a method-scoped static variable. Serves the same purpose, has no impact outside of the method and does not produce unneeded overhead.
So, something simple like this would have been preferable:
On subsequent calls, the first line is skipped at compile-time already, and the second immediately fails, skipping a duplicate registration.
No globals involved (even indirectly through $wp_filters).
The text was updated successfully, but these errors were encountered:
Issue #40 correctly suggested to get rid of the global variable (globals are always bad and should be avoided at all cost).
However, the proposed solution in turns a single check into three function calls that are processed through major parts of the WordPress system (and, ironically, rely on multiple globals as well).
I better fix would have been to turn the global variable into a method-scoped static variable. Serves the same purpose, has no impact outside of the method and does not produce unneeded overhead.
So, something simple like this would have been preferable:
On subsequent calls, the first line is skipped at compile-time already, and the second immediately fails, skipping a duplicate registration.
No globals involved (even indirectly through
$wp_filters
).The text was updated successfully, but these errors were encountered: