If any admin functions are used within the filter, their existence should be checked with `function_exists()` before being used.
Follow-up to [47763], [48620].
Props audrasjb, garrett-eclipse, Howdy_McGee, dlh, khag7, SergeyBiryukov.
Fixes#51081.
git-svn-id: https://develop.svn.wordpress.org/trunk@48910 602fd350-edb4-49c9-b593-d223f7449a82
The value is internally used to detect whether nothing has hooked into this filter.
Props audrasjb, pbiron, johnbillion, SergeyBiryukov.
Fixes#50848.
git-svn-id: https://develop.svn.wordpress.org/trunk@48909 602fd350-edb4-49c9-b593-d223f7449a82
This ensures consistent results in query var tests, regardless of whether they are run in isolation or as part of a larger group of tests.
Props pbiron, peterwilsoncc.
Fixes#51154.
git-svn-id: https://develop.svn.wordpress.org/trunk@48908 602fd350-edb4-49c9-b593-d223f7449a82
Replace the legacy `.error` class with a more appropriate `.notice-warning`.
Props musicaljoeker, shital-patel, man4toman, garrett-eclipse, SergeyBiryukov.
Fixes#50766.
git-svn-id: https://develop.svn.wordpress.org/trunk@48906 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a fatal error if a plugin calls image creation or editing functions like `wp_imagecreatetruecolor()` outside of the admin.
Follow-up to [48798]
Props BackuPs.
Fixes#51174. See #50833.
git-svn-id: https://develop.svn.wordpress.org/trunk@48905 602fd350-edb4-49c9-b593-d223f7449a82
Synchronize description of the `$enabled` parameter with the `auto_plugin_update_send_email` filter.
Follow-up to [48889].
See #50768, #50988.
git-svn-id: https://develop.svn.wordpress.org/trunk@48903 602fd350-edb4-49c9-b593-d223f7449a82
The intention of `wp_get_environment_type()` is to provide a consistent means of identifying the environment type, not of identifying a specific environment.
Actual environments should fit within one of the existing types: `local`, `development`, `staging`, or `production`. That should cover the types that plugins and themes might be concerned about when toggling functionality.
Props johnbillion, joostdevalk, TimothyBlynJacobs, jeremyfelt, batmoo, claytoncollie, Clorith, markjaquith, garrett-eclipse, GaryJ, elrae.
Fixes#50992.
git-svn-id: https://develop.svn.wordpress.org/trunk@48894 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that `wp_localize_script( 'jquery', ... )` continues to work as expected, since `WP_Scripts::localize()` rewrites the `jquery` handle to `jquery-core` internally.
Follow-up to [48323].
Props mukesh27, rajeshsingh520, johnbillion, TimothyBlynJacobs, TobiasBg.
Fixes#50919.
git-svn-id: https://develop.svn.wordpress.org/trunk@48890 602fd350-edb4-49c9-b593-d223f7449a82
This adds an additional parameter to the `auto_plugin_update_send_email` and `auto_theme_update_send_email` filters to provide the additional context of which updates were attempted and their outcome. This will help plugin and theme auto-update emails to be better tailored to a site owner’s liking.
Props audrasjb, Paddy Landau, desrosj.
Fixes#50988.
git-svn-id: https://develop.svn.wordpress.org/trunk@48888 602fd350-edb4-49c9-b593-d223f7449a82
In [48306] support for multi-typed schemas was improved to first detect the data type of the value before applying further validation. The `integer` data type was detected using the new `rest_is_integer` function. This function used logic, however, that assumed that the value had already passed an `is_numeric` check. This meant that if `integer` and `string` were both acceptable types, the value would always be considered an `integer` causing the later accurate type validation to fail.
This commit fixes the `rest_is_integer` logic to include an `is_numeric` check.
Props rtagliento.
Fixes#51146.
git-svn-id: https://develop.svn.wordpress.org/trunk@48881 602fd350-edb4-49c9-b593-d223f7449a82
Even with these values documented as an array of integers, they can technically also accept an array of strings, e.g. as form results.
Add a unit test.
Props brianhogg, TimothyBlynJacobs, SergeyBiryukov.
Fixes#51137.
git-svn-id: https://develop.svn.wordpress.org/trunk@48880 602fd350-edb4-49c9-b593-d223f7449a82
`document.getElementById()` returns `null` if no matching element was found, so the previous comparison didn't work as expected.
Follow-up to [47506].
Props mailnew2ster, sarahricker.
Fixes#38009.
git-svn-id: https://develop.svn.wordpress.org/trunk@48876 602fd350-edb4-49c9-b593-d223f7449a82
Update `redirect_canonical()` to account for custom pagination and URL format used by sitemaps in order to follow standard practices.
Introduce the function `get_sitemap_url()` to simplify getting the index and provider URLs as needed.
Props jonathanstegall, pbiron, GamerZ, salvoaranzulla, peterwilsoncc.
Fixes#50910.
git-svn-id: https://develop.svn.wordpress.org/trunk@48872 602fd350-edb4-49c9-b593-d223f7449a82
Custom site logos are most commonly displayed above the fold, so lazy-loading is unnecessary.
Props demetris, khag7, johnbillion, rebasaurus, audrasjb.
Fixes#50933.
git-svn-id: https://develop.svn.wordpress.org/trunk@48870 602fd350-edb4-49c9-b593-d223f7449a82
This addresses a regression in [47808], where the `home` check expected an empty string to use `siteurl` as a fallback, but `wpdb::get_var()` returns `null` if the option is empty.
Props fjarrett.
Fixes#51011.
git-svn-id: https://develop.svn.wordpress.org/trunk@48868 602fd350-edb4-49c9-b593-d223f7449a82
A better solution for the original issue will be explored in a future release.
Props audrasjb, garrett-eclipse, webzunft, Krstarica, chunkysteveo, SergeyBiryukov.
Fixes#50882, #50998. See #46872.
git-svn-id: https://develop.svn.wordpress.org/trunk@48866 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that the patterns respect the theme's default color for body text and avoids contrast issues, particularly in dark themes.
Props nrqsnchz, mapk, fullofcaffeine.
Fixes#50892.
git-svn-id: https://develop.svn.wordpress.org/trunk@48864 602fd350-edb4-49c9-b593-d223f7449a82
Color schemes should only affect colors, to avoid diverging from a consistent and predictable layout, especially if core CSS rules subsequently change.
Follow-up to [48277], [48286], [48345].
Props Joen, johnbillion, afercia, johnjamesjacoby.
Fixes#51127. See #50504.
git-svn-id: https://develop.svn.wordpress.org/trunk@48862 602fd350-edb4-49c9-b593-d223f7449a82
This allows for better localization in languages where adjectives are translated differently depending on which noun they modify, or when a different translation is required for a noun vs. a verb.
Props dimadin, justinahinon.
Fixes#49797.
git-svn-id: https://develop.svn.wordpress.org/trunk@48861 602fd350-edb4-49c9-b593-d223f7449a82
This gives developers a better control over their existing development workflow and ensures that `local` is not the exact same as `development` if it does not need to be.
Props claytoncollie, johnbillion, jeremyfelt, kreppar, dushakov, TimothyBlynJacobs, Ipstenu, khag7, knutsp, Clorith, markjaquith, joostdevalk, SergeyBiryukov.
Fixes#51064.
git-svn-id: https://develop.svn.wordpress.org/trunk@48856 602fd350-edb4-49c9-b593-d223f7449a82
Any notices in that file happen before `WP_DEBUG` takes effect, and should not be displayed with the `error_reporting` level previously set in `wp-load.php`.
Adding the class when there is no notice displayed results in extra padding under the admin bar, which should be avoided.
Follow-up to [20102], [21025], [26620], [47745].
Props akissz, tw2113, laxman-prajapati, sabernhardt, johnbillion, SergeyBiryukov.
Fixes#51073.
git-svn-id: https://develop.svn.wordpress.org/trunk@48850 602fd350-edb4-49c9-b593-d223f7449a82
As per the documentation of the `@covers` tag, global functions being covered should be prefixed with `::`. Also, the `()` after the function name is redundant.
Follow-up to [39918].
Props jrf.
See #50267.
git-svn-id: https://develop.svn.wordpress.org/trunk@48848 602fd350-edb4-49c9-b593-d223f7449a82
This makes the configuration consistent with the `WP_RUN_CORE_TESTS` constant being set to `1` in the same config file.
Additionally, update the list to be in line with the current codebase, excluding the plugins and themes bundled with WordPress core from being considered for code coverage.
Note: If you have a local `phpunit.xml` file that changes the `WP_RUN_CORE_TESTS` constant to `0`, you should also - in the same file - change the code coverage setup to use the `src` directory.
Follow-up to [42665], [43311].
Props jrf, mmarco9.
See #50267.
git-svn-id: https://develop.svn.wordpress.org/trunk@48847 602fd350-edb4-49c9-b593-d223f7449a82
This fixes random test failures when one of the term IDs from previous tests coincides with the orphan term ID from this test that should not be lazy-loaded.
Follow-up to [34529], [36566].
Fixes#51109.
git-svn-id: https://develop.svn.wordpress.org/trunk@48844 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a PHP notice if the API returns a plugin with empty data for `blocks` key.
Props khag7, TwentyZeroTwo, justinahinon, TimothyBlynJacobs, dd32, SergeyBiryukov.
Fixes#51018.
git-svn-id: https://develop.svn.wordpress.org/trunk@48842 602fd350-edb4-49c9-b593-d223f7449a82
This fixes a PHP 8 "Only the first byte will be assigned to the string offset" warning on Edit Post screen.
The correct usage of `wp_localize_script()` is to pass an array of data, not a string.
Fixes#51108.
git-svn-id: https://develop.svn.wordpress.org/trunk@48841 602fd350-edb4-49c9-b593-d223f7449a82
This brings `wp_count_terms()` in line with other taxonomy functions such as `get_terms()` which technically no longer require a taxonomy. Similar to the previously modified functions, no deprecation warning is triggered when using the legacy signature.
Fixes#36399.
git-svn-id: https://develop.svn.wordpress.org/trunk@48840 602fd350-edb4-49c9-b593-d223f7449a82
As per the documentation of `call_user_func_array()`, the `$param_arr` should be a (numerically) indexed array, not a string-keyed array.
As we can use the spread operator in PHP 5.6+, there isn't really any need to use `call_user_func_array()` anyhow, we can call the `array_merge()` function directly.
The caveat to this is that the spread operator only works on numerically indexed arrays, so we need to wrap the `$sidebars_widgets` variable in a call to `array_values()` when using the spread operator.
Using `array_values()` in the existing `call_user_func_array()` call would also have solved this, but the solution now proposed, has the added benefit of getting rid of the overhead of `call_user_func_array()`.
Props jrf.
See #50913.
git-svn-id: https://develop.svn.wordpress.org/trunk@48839 602fd350-edb4-49c9-b593-d223f7449a82
The WP native `get_comment()` function expects the first argument `$comment` to be passed by reference.
The PHP `array_map()` function, however, passes by value, not by reference, resulting in an "arguments must be passed by reference, value given" error.
The PHP native `array_walk()` function does pass by reference. Using this prevents the error on PHP 8 and maintains the existing behaviour on PHP < 8.
Props jrf.
See #50913.
git-svn-id: https://develop.svn.wordpress.org/trunk@48838 602fd350-edb4-49c9-b593-d223f7449a82
When iterating over the items stored in '_wp_suggested_privacy_policy_content` meta value for the Privacy Policy page, make sure the item is an array before accessing its properties.
Props treibstoff.
Fixes#51084.
git-svn-id: https://develop.svn.wordpress.org/trunk@48836 602fd350-edb4-49c9-b593-d223f7449a82