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
Is your feature request related to a problem? Please describe.
The breadcrumb filters rank_math/frontend/breadcrumb/settings and rank_math/frontend/breadcrumb/strings initially pas an empty array, instead of the default settings and strings. This makes them less useful than they could be.
For example, to get translation strings from a plugin like Polylang, we need the original string. If the rank_math/frontend/breadcrumb/strings would pass the original strings (instead of an empty array) then the original string could be used like pll__( $string ); to get the translation dynamically. Without it, the filter must jump to many more hoops to first fetch the original string, then return the translation.
Describe the solution you'd like
If the original values are passed to the filter, then any added filters can use them if needed.
Describe alternatives you've considered
A filter can hardcode translation strings, but if the original value is changed in the Rank Math settings, the filter code must be adapted accordingly.
A filter can do the work to fetch the original values, but will depend on Rank Math specific functions. This makes them less future proof. For instance, the filter might use RankMath\Helper::get_settings( 'general.breadcrumbs_prefix' ) to get the original prefix setting, but if the Helper class is changed at any point in the future, the code will break.
Additional context
An example of a filter that I expected to work but fails, due to an empty array:
Is your feature request related to a problem? Please describe.
The breadcrumb filters
rank_math/frontend/breadcrumb/settings
andrank_math/frontend/breadcrumb/strings
initially pas an empty array, instead of the default settings and strings. This makes them less useful than they could be.For example, to get translation strings from a plugin like Polylang, we need the original string. If the
rank_math/frontend/breadcrumb/strings
would pass the original strings (instead of an empty array) then the original string could be used likepll__( $string );
to get the translation dynamically. Without it, the filter must jump to many more hoops to first fetch the original string, then return the translation.Describe the solution you'd like
If the original values are passed to the filter, then any added filters can use them if needed.
Describe alternatives you've considered
A filter can hardcode translation strings, but if the original value is changed in the Rank Math settings, the filter code must be adapted accordingly.
A filter can do the work to fetch the original values, but will depend on Rank Math specific functions. This makes them less future proof. For instance, the filter might use
RankMath\Helper::get_settings( 'general.breadcrumbs_prefix' )
to get the original prefix setting, but if the Helper class is changed at any point in the future, the code will break.Additional context
An example of a filter that I expected to work but fails, due to an empty array:
Instead, the following is needed:
Please let filters be filters :)
The text was updated successfully, but these errors were encountered: