-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Soft-deprecate load_*_textdomain()
functions
#7480
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Only 1 failing test, that sounds doable :-)
|
OK when I remove the now unused |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
* @param string $locale The plugin's current locale. | ||
* @param string $domain Text domain. Unique identifier for retrieving translated strings. | ||
*/ | ||
$locale = apply_filters( 'plugin_locale', determine_locale(), $domain ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Many plugins uses the filter https://wpdirectory.net/search/01J96KCH95TBF66SB7N0PKAFM2. We are going to remove these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the removal of this code there is nothing this filter could be used for anymore. If a plugin is hooking into that filter it simply won't do anything.
We could consider using apply_filters_deprecated
without actually using the filter. There's prior art here:
wordpress-develop/src/wp-includes/rest-api/class-wp-rest-server.php
Lines 333 to 352 in 1ec0abb
/** | |
* Filters whether the REST API is enabled. | |
* | |
* @since 4.4.0 | |
* @deprecated 4.7.0 Use the {@see 'rest_authentication_errors'} filter to | |
* restrict access to the REST API. | |
* | |
* @param bool $rest_enabled Whether the REST API is enabled. Default true. | |
*/ | |
apply_filters_deprecated( | |
'rest_enabled', | |
array( true ), | |
'4.7.0', | |
'rest_authentication_errors', | |
sprintf( | |
/* translators: %s: rest_authentication_errors */ | |
__( 'The REST API can no longer be completely disabled, the %s filter can be used to restrict access to the API, instead.' ), | |
'rest_authentication_errors' | |
) | |
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, I don't think apply_filters_deprecated
makes sense though. If you're developing a custom plugin there's a legitimate use for using load_plugin_textdomain()
. You shouldn't be faced with a deprecation warning even if you use it properly.
Committed in https://core.trac.wordpress.org/changeset/59157 |
(Soft) deprecate
load_plugin_textdomain()
andload_theme_textdomain()
and rely solely on the just-in-time loading andWP_Textdomain_Registry
.This would avoid any
_doing_it_wrong
messages for plugins still usingload_plugin_textdomain()
, which seems to be the most common case and affects even very big plugins. So it would drastically reduce the noise.It would still trigger a
_doing_it_wrong
message if accidentally causing the just-in-time loading too early.Trac ticket: https://core.trac.wordpress.org/ticket/44937
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.