sybrew/the-seo-framework

Too early apply_filters calls

Closed this issue · 4 comments

Describe the bug

apply_filters calls in bootstrap/define.php are executed before plugins_loaded thus almost always return their default values.

A WordPress plugin should boot after plugins_loaded.

source

sybrew commented

Those filters can be written to by mu-plugins.

Yes.
But that is a not a plugin area.

Please consider moving them after plugins_loaded.

sybrew commented

I'll remove the filters in 5.0. There's no reason these constants must be filterable; the filters only cause overhead and code debt.

This affects constants:

  • THE_SEO_FRAMEWORK_SITE_OPTIONS
  • THE_SEO_FRAMEWORK_TERM_OPTIONS
  • THE_SEO_FRAMEWORK_USER_OPTIONS
  • THE_SEO_FRAMEWORK_SITE_CACHE

And affects filters:

  • the_seo_framework_site_options
  • the_seo_framework_term_options
  • the_seo_framework_user_options
  • the_seo_framework_site_cache

I may want to consider adding a "is defined" check, but filtering WordPress Core's option/user/term handlers is more suitable for end-users.