Using `var` or only `static` to declare a class property is PHP 4 code.
This updates the codebase to use explicit visibility modifiers introduced in PHP 5.
Props jrf.
Fixes#51557. See #22234.
git-svn-id: https://develop.svn.wordpress.org/trunk@49184 602fd350-edb4-49c9-b593-d223f7449a82
- Enable arranging only when the Screen Options tab is open.
- Prevent accidental/unintended dragging. Seen it happen mostly on laptops when using the mousepad/trackpad.
- Improve discoverability and usefulness by always showing the "drop zones" outline when postboxes are draggable/arrangeable.
- Add some (brief) explanation to the Screen Options tab helping the user understand what options are available and how to change them. This is especially helpful for screen reader users to give an idea how to use the screen options and what to expect.
- Fix/enhance some of the code in `postbox.js` and make it coding standards compliant.
See #50699.
git-svn-id: https://develop.svn.wordpress.org/trunk@49179 602fd350-edb4-49c9-b593-d223f7449a82
This avoids overlapping with action buttons and brings some consistency to bottom paddings across various screens.
Props passoniate, afercia, anuj2, rolfsiebers, uxkai, ireneyoast, thijsvanloef, hellofromTonya, audrasjb, helen, SergeyBiryukov.
Fixes#49246.
git-svn-id: https://develop.svn.wordpress.org/trunk@49178 602fd350-edb4-49c9-b593-d223f7449a82
If the theme declares support for the `html5` feature `navigation-widgets`, the tag cloud widget is now wrapped in a `<nav>` element to improve semantics and accessibility.
The `<nav>` elements are native landmark regions, which helps assistive technology users to navigate through them.
Follow-up to [48349] for other widgets.
Props audrasjb, justinahinon, ravipatel.
Fixes#51455. See #48170.
git-svn-id: https://develop.svn.wordpress.org/trunk@49177 602fd350-edb4-49c9-b593-d223f7449a82
Wraps `Imagick::readImage()` for PDFs with exception handling, trying again without `use-cropbox` if this fails.
Introduces `WP_Image_Editor_Imagick::pdf_load_source()`.
Works around a known issue in Ghostscript 8.70 (fixed in 8.71) that results in a stack underflow.
While it only affects this version, it remains a common version found on hosts, and prevented some PDF thumbnails from being generated.
See this Ghostscript bug for more details: https://bugs.ghostscript.com/show_bug.cgi?id=690676
Props azaozz, joseaneto, cranewest, dantahoua, n5hzr, mikeschroder.
Fixes#48853.
git-svn-id: https://develop.svn.wordpress.org/trunk@49174 602fd350-edb4-49c9-b593-d223f7449a82
Introduces the action `wp_after_insert_post` inside a wrapper function of the same name. This hook allows plugin developers to access a posts full data (including its terms and meta data) regardless of the workflow used to save it.
A new parameter is introduced to `wp_insert_post()` to indicate whether the hook should be fired within the function call or will be fired afterward.
Props aristath, Collizo4sky, danielbachhuber, joyously, kadamwhite, kraftbj, markparnell, mikeschroder, noisysocks, peterwilsoncc, SergeyBiryukov, talldanwp, thewebprincess, TimothyBlynJacobs.
Fixes#45114.
git-svn-id: https://develop.svn.wordpress.org/trunk@49172 602fd350-edb4-49c9-b593-d223f7449a82
Add a `use` to a closure to avoid an undefined variable throwing a warning. Adds unit tests to ensure the custom callbacks run as expected when defined.
Follow up to [49141].
Props ocean90, dd32.
Fixes#40351.
git-svn-id: https://develop.svn.wordpress.org/trunk@49171 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a PHP notice for an undefined index of either `plugin` or `theme` in the `auto_{plugin|theme}_update_send_email` filter hook.
Props afragen, audrasjb.
Fixes#51400.
git-svn-id: https://develop.svn.wordpress.org/trunk@49166 602fd350-edb4-49c9-b593-d223f7449a82
This updates:
- `react` and `react-dom` from `16.9.0` to `16.13.1`.
- `lodash from `4.17.15` to `4.17.19`.
Props isabel_brison.
Fixes#51505.
git-svn-id: https://develop.svn.wordpress.org/trunk@49165 602fd350-edb4-49c9-b593-d223f7449a82
When the `mysql` extention isn't loaded and a custom db dropin is not in place, we give folks a nice error. However, we can't assume that the `WP_CONTENT_DIR` constant is set yet since this runs before we define default constants.
This fixes a PHP 8 error.
Props jorbin.
Merges [49161] to trunk.
See #50913.
git-svn-id: https://develop.svn.wordpress.org/trunk@49163 602fd350-edb4-49c9-b593-d223f7449a82
This provides more flexibility when writing tests and benefits from running in a front-end context which is necessary for some tests like checking that updates are supported. Additionally, this provides a more robust interface for developers who want to integrate with Site Health tests.
Because the `wp/v2` endpoint is reserved for modeling core entities, site health is registered in its own `wp-site-health/v1` namespace.
The existing ajax actions have been maintained for backward compatibility.
Props Clorith, chrisvanpatten, afragen, pokhriyal, TimothyBlynJacobs.
Fixes#48105.
git-svn-id: https://develop.svn.wordpress.org/trunk@49154 602fd350-edb4-49c9-b593-d223f7449a82
r49145 and r49146 were originally planned for 5.6 when they were committed, but are now planned for 5.5.2.
See #51130.
git-svn-id: https://develop.svn.wordpress.org/trunk@49152 602fd350-edb4-49c9-b593-d223f7449a82
* Deprecate the `l10n` property on `communityEventsData`.
* Introduce `version` parameter for `deprecateL10nObject` and backfill the version for deprecated objects in 5.5.0.
* Add a noop version of `deprecateL10nObject` for QUnit testing.
Fixes#51498.
git-svn-id: https://develop.svn.wordpress.org/trunk@49151 602fd350-edb4-49c9-b593-d223f7449a82
The previous commits intentionally didn't include these, because it would have added an unreasonable amount of diff noise.
See #51130
git-svn-id: https://develop.svn.wordpress.org/trunk@49147 602fd350-edb4-49c9-b593-d223f7449a82
The `date` and `end_date` fields are ''WP'' timestamps representing the venue's local time. As of meta:changeset:10270 (#meta4480), new `start_unix_timestamp` and `end_unix_timestamp` values are available, providing a proper ''Unix'' timestamp in the UTC timezone. Using those is more precise, and removes the time window where the event has expired but still appears in the Events Widget.
To simplify the function, it now only accepts and returns the events themselves, rather than the entire response body.
See #51130
See #meta4480
Related: https://make.wordpress.org/core/2019/09/23/date-time-improvements-wp-5-3/
git-svn-id: https://develop.svn.wordpress.org/trunk@49145 602fd350-edb4-49c9-b593-d223f7449a82
When modifying terms assigned to an object, replace full term recounts with incrementing/decrementing the count as appropriate. This provides a significant performance boost on sites with a high number of term/object relationships and/or posts.
Introduces the functions `wp_increment_term_count()`, `wp_decrement_term_count()`, `wp_modify_term_count_by()` and `wp_modify_term_count_by_now()` for updating the term count.
Introduces the function `_wp_prevent_term_counting()` for preventing double counting on posts that are about to transition.
Adds the parameter `update_count_by_callback` to `register_taxonomy()` to allow developers to use a custom callback for incrementing or decrementing a term count.
Props boonebgorges, davidbaumwald, hellofromTonya, johnbillion, lcyh78, mattoperry, peterwilsoncc, rebasaurus, whyisjake.
Fixes#40351.
git-svn-id: https://develop.svn.wordpress.org/trunk@49141 602fd350-edb4-49c9-b593-d223f7449a82
This will make testing the new feature easier since the local development environment is only accessible via HTTP by default.
Also update docs to link to the relevant filters.
See #42790.
Fixes#51503.
git-svn-id: https://develop.svn.wordpress.org/trunk@49139 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a PHP warning during sitemap generation if `get_term_link()` returns an error, e.g. due to term ID being shared between multiple taxonomies.
Additionally, pass the `$taxonomy` argument to `get_term_link()` to properly disambiguate the call.
Props dd32.
Fixes#51416.
git-svn-id: https://develop.svn.wordpress.org/trunk@49137 602fd350-edb4-49c9-b593-d223f7449a82
This allows for making REST API calls with the PUT and DELETE HTTP methods that may be blocked or unsupported by some server configurations.
Props yakimun.
Fixes#43605.
git-svn-id: https://develop.svn.wordpress.org/trunk@49133 602fd350-edb4-49c9-b593-d223f7449a82
This allows for clients to search the used post formats via the /wp/v2/search endpoint by using a type=post-format query parameter.
Fixes#51459.
Props andraganescu, zieladam, noisysocks, TimothyBlynJacobs.
git-svn-id: https://develop.svn.wordpress.org/trunk@49132 602fd350-edb4-49c9-b593-d223f7449a82
These functions did previously accept an array of image dimensions but their class attributes were not properly constructed.
Fixes#51362
git-svn-id: https://develop.svn.wordpress.org/trunk@49128 602fd350-edb4-49c9-b593-d223f7449a82
contents.
* The `send_new_site_email` filter can be used to disable this email.
* The `new_site_email` filter can be used to modify its contents.
Props Dhruvin, Dharm1025, dharmin16, jipmoors
Fixes#42134
git-svn-id: https://develop.svn.wordpress.org/trunk@49127 602fd350-edb4-49c9-b593-d223f7449a82
This allows for edits to be made to a restored post before it goes live again. This also prevents scheduled posts being published unexpectedly if they are untrashed after their originally scheduled date.
The old behaviour of restoring untrashed posts to their original status can be reinstated using the `wp_untrash_post_set_previous_status()` helper function.
Also fixes an issue where the incorrect post ID gets passed to hooks if no post ID is passed to the function.
Props harrym, bananastalktome, jaredcobb, chriscct7, melchoyce, johnbillion, pankajmohale
Fixes#23022
git-svn-id: https://develop.svn.wordpress.org/trunk@49125 602fd350-edb4-49c9-b593-d223f7449a82
Fix an issue where users could save a password with only spaces, or spaces at the beginning or end of their password, preventing them from logging in.
Props ronakganatra, 1naveengiri, ajensen, oolleegg55, bookdude13, nrqsnchz, aristath.
Fixes#42766.
git-svn-id: https://develop.svn.wordpress.org/trunk@49118 602fd350-edb4-49c9-b593-d223f7449a82
This allows multiple errors to be instantiated independently but collected into one without having to manually combine their properties.
Props rmccue, dlh, TimothyBlynJacobs
Fixes#38777
git-svn-id: https://develop.svn.wordpress.org/trunk@49115 602fd350-edb4-49c9-b593-d223f7449a82
These days there are often 2 posts published close to each other, like a release announcement and a Month In WordPress post. When that happens, the earlier post is often pushed out of the widget before many people have had a chance to see it.
Ideally, the number of total items would remain at `4`, to reduce visual clutter. Implementing a conditional item would require a significant refactor, though. Increasing the total number of items to `5` is a practical compromise.
Props hlashbrooke, tellyworth.
Fixes#43441.
git-svn-id: https://develop.svn.wordpress.org/trunk@49114 602fd350-edb4-49c9-b593-d223f7449a82
This allows the user to go back without saving any changes to the widget.
Props garrett-eclipse, audrasjb, afercia.
Fixes#49354.
git-svn-id: https://develop.svn.wordpress.org/trunk@49113 602fd350-edb4-49c9-b593-d223f7449a82
The action fires immediately after transitioning a comment's status from one to another in the database and removing the comment from the object cache, but prior to all status transition hooks.
Props davidbaumwald, henry.wright.
Fixes#51481.
git-svn-id: https://develop.svn.wordpress.org/trunk@49111 602fd350-edb4-49c9-b593-d223f7449a82
In WordPress 4.4 the REST API was first introduced. A few releases later in WordPress 4.7, the Content API endpoints were added, paving the way for Gutenberg and countless in-site experiences. In the intervening years, numerous plugins have built on top of the REST API. Many developers shared a common frustration, the lack of external authentication to the REST API.
This commit introduces Application Passwords to allow users to connect to external applications to their WordPress website. Users can generate individual passwords for each application, allowing for easy revocation and activity monitoring. An authorization flow is introduced to make the connection flow simple for users and application developers.
Application Passwords uses Basic Authentication, and by default is only available over an SSL connection.
Props georgestephanis, kasparsd, timothyblynjacobs, afercia, akkspro, andraganescu, arippberger, aristath, austyfrosty, ayesh, batmoo, bradyvercher, brianhenryie, helen, ipstenu, jeffmatson, jeffpaul, joostdevalk, joshlevinson, kadamwhite, kjbenk, koke, michael-arestad, Otto42, pekz0r, salzano, spacedmonkey, valendesigns.
Fixes#42790.
git-svn-id: https://develop.svn.wordpress.org/trunk@49109 602fd350-edb4-49c9-b593-d223f7449a82
Fixes test_block_styles_for_editing_with_theme_support and
test_block_styles_for_viewing_with_theme_support by partially reverting [49102]
and only calling wp_should_load_block_editor_scripts_and_styles() when on an
admin screen.
Props TimothyBlynJacobs.
See #51330.
git-svn-id: https://develop.svn.wordpress.org/trunk@49104 602fd350-edb4-49c9-b593-d223f7449a82
This allows for clients to search the available terms via the `/wp/v2/search` endpoint by using a `type=term` query parameter.
Fixes#51458.
Props andraganescu, zieladam, noisysocks, TimothyBlynJacobs.
git-svn-id: https://develop.svn.wordpress.org/trunk@49103 602fd350-edb4-49c9-b593-d223f7449a82
Do not call the should_load_block_editor_scripts_and_styles filter on non-admin
screens. This makes it less likely that one will accidentally call
get_current_screen() when it doesn't exist.
Follow-up to [49080].
Props noahtallen.
See #51330.
git-svn-id: https://develop.svn.wordpress.org/trunk@49102 602fd350-edb4-49c9-b593-d223f7449a82
- Add jquery-migrate.js v.3.3.1 to core and load it in debug mode when `SCRIPT_DEBUG` is true.
- Add jquery.min.js, update jquery.js to 3.5.1 non-minified. This should help when debugging.
- Rebuild jQuery UI 1.12.1 and add it to core.
- Fix/adjust tests to match the above changes.
See #50564.
git-svn-id: https://develop.svn.wordpress.org/trunk@49101 602fd350-edb4-49c9-b593-d223f7449a82
Makes the inline docs for set_query_var() consistent with the inline docs for
get_query_var().
See #42783.
Props stevenlinx, markparnell.
git-svn-id: https://develop.svn.wordpress.org/trunk@49094 602fd350-edb4-49c9-b593-d223f7449a82
Synchronize documentation of the `::check_package()` method between `Plugin_Upgrader`, `Theme_Upgrader`, and `Language_Pack_Upgrader`.
Props ankitmaru, mukesh27, desrosj.
Fixes#51448.
git-svn-id: https://develop.svn.wordpress.org/trunk@49091 602fd350-edb4-49c9-b593-d223f7449a82
Primarily this adds "user privacy" to the strings for privacy requests, so they are more easily distinguished from other system actions within logs.
Props garrett-eclipse, carike, birgire.
Fixes#51351.
git-svn-id: https://develop.svn.wordpress.org/trunk@49090 602fd350-edb4-49c9-b593-d223f7449a82
Previously, the search controller infrastructure required that the id property was an integer. This prevents data models that use a string id from utilizing the search infrastructure.
This commit lifts the restraint that search handlers return integer ids. This will allow for the Post Formats search handler coming in 5.6 to use slugs instead of creating fake ids.
Props stoyangeorgiev.
Fixes#51131.
git-svn-id: https://develop.svn.wordpress.org/trunk@49088 602fd350-edb4-49c9-b593-d223f7449a82
Clear the crop selection input fields after the crop action is complete.
Fixes unexpected re-cropping behavior if the crop button was clicked more than once.
Props davidbinda.
Fixes#30155.
git-svn-id: https://develop.svn.wordpress.org/trunk@49087 602fd350-edb4-49c9-b593-d223f7449a82
This makes `wp_get_attachment_metadata()` run significantly faster. See ticket for benchmarking.
Props Tkama, donmhico.
Fixes#50679.
git-svn-id: https://develop.svn.wordpress.org/trunk@49084 602fd350-edb4-49c9-b593-d223f7449a82
Adds a new should_load_block_editor_scripts_and_styles filter which can be used
by plugins including Gutenberg to more precisely customise when block editor
scripts and styles should be loaded by script-loader.php. Previously, plugins
had to fiddle with $current_screen->is_block_editor().
Props zieladam.
See #51330.
git-svn-id: https://develop.svn.wordpress.org/trunk@49080 602fd350-edb4-49c9-b593-d223f7449a82
PHP 8 changes the way string to number comparisons are performed: https://wiki.php.net/rfc/string_to_number_comparison
In particular, when calling `max()` on an array with numeric values and a non-numeric string, in PHP 8 the string is returned instead of a number.
For `::import_theme_starter_content()`, this resulted in retrieving the `_multiwidget` property instead of the maximum widget number for a particular type.
By explicitly ignoring the `_multiwidget` property, we make sure to retrieve the correct widget number value.
Follow-up to [48960], [49043].
See #50913.
git-svn-id: https://develop.svn.wordpress.org/trunk@49076 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a fatal error on PHP 8 caused by passing a `false` value to `fread()`, instead of a file resource.
See #50913.
git-svn-id: https://develop.svn.wordpress.org/trunk@49073 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a fatal error on PHP 8 caused by passing an empty string to `mysqli_query()`, and maintains the current behaviour.
Follow-up to [48980], [48981].
See #50913, #50639.
git-svn-id: https://develop.svn.wordpress.org/trunk@49072 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a "Missing format specifier at end of string" fatal error on PHP 8, and maintains the current behaviour.
See #50913.
git-svn-id: https://develop.svn.wordpress.org/trunk@49068 602fd350-edb4-49c9-b593-d223f7449a82
* Make the "Copied!" text green.
* Make the button verbiage clear that it's copied "to clipboard".
Props garrett-eclipse, mukesh27.
Fixes#51355.
git-svn-id: https://develop.svn.wordpress.org/trunk@49064 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a JS error when refreshing the "Attachment details" modal for an item that is not currently queried.
Follow-up to [41021].
Props Mista-Flo, mukesh27.
Fixes#51395.
git-svn-id: https://develop.svn.wordpress.org/trunk@49062 602fd350-edb4-49c9-b593-d223f7449a82
The parameter's default value is different from the one in `WP_Term_Query::__construct()`, and should be documented accordingly.
This also clarifies that the `taxonomy` parameter of `wp_list_categories()` only accepts a string, not an array.
Follow-up to [40903], [41767], [45894], [45895].
Props grapplerulrich, mukesh27, TimothyBlynJacobs, SergeyBiryukov.
Fixes#51378. See #47896.
git-svn-id: https://develop.svn.wordpress.org/trunk@49060 602fd350-edb4-49c9-b593-d223f7449a82
This addresses an "Undefined constant `MB_OVERLOAD_STRING`" fatal error in the `ParagonIE_Sodium_Core_Util::isMbStringOverride()` method.
In PHP 8, the `MB_OVERLOAD_STRING` constant has been removed, along with the `mbstring` function overloading feature.
Fixes#51399.
git-svn-id: https://develop.svn.wordpress.org/trunk@49057 602fd350-edb4-49c9-b593-d223f7449a82
This adds support for the secure and ipv6 variants of the already allowed irc protocol.
Props arealnobrainer, markparnell, ctmartin.
git-svn-id: https://develop.svn.wordpress.org/trunk@49055 602fd350-edb4-49c9-b593-d223f7449a82
Previously, the PHP Fileinfo extension used to detect CSV files as `text/plain`.
In PHP 8, this has changed, and CSV files are detected as `application/csv`.
Follow-up to [44438].
See #50913.
git-svn-id: https://develop.svn.wordpress.org/trunk@49049 602fd350-edb4-49c9-b593-d223f7449a82
PHP 8 changes the way string to number comparisons are performed: https://wiki.php.net/rfc/string_to_number_comparison
In particular, checking if a non-empty, non-numeric string is greater than zero in PHP 8 evaluates to `true`, not `false`.
For `wp_insert_term()`, this resulted in a "Parent term does not exist" error for a non-numeric string, instead of discarding the value.
By explicitly casting the value to `int`, we make sure to compare both values as numbers, rather than a string and a number.
Follow-up to [29196], [29830], [29867].
See #50913.
git-svn-id: https://develop.svn.wordpress.org/trunk@49043 602fd350-edb4-49c9-b593-d223f7449a82
When changing exports location via these filters, make sure to migrate the files to the new directory, to avoid breaking any existing exports.
Follow-up to [48127], [48330].
Props garrett-eclipse.
Fixes#51361.
git-svn-id: https://develop.svn.wordpress.org/trunk@49042 602fd350-edb4-49c9-b593-d223f7449a82
Add inline documentation for the 'template' arg accepted by
register_post_type().
Props milana_cap.
See #46261.
git-svn-id: https://develop.svn.wordpress.org/trunk@49041 602fd350-edb4-49c9-b593-d223f7449a82
The block editor provides its own interface for managing screen options, so we
can safely hide Screen Options tab found in the top right of the page.
Props aduth.
See #46157.
git-svn-id: https://develop.svn.wordpress.org/trunk@49040 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a few PHP notices if the `include_selected` parameter was specified and a non-existing user ID was passed.
Props campusboy1987.
Fixes#51370.
git-svn-id: https://develop.svn.wordpress.org/trunk@49036 602fd350-edb4-49c9-b593-d223f7449a82
This avoids an error on PHP 8 caused by passing an empty string to `array_merge()`, instead of an array.
See #50913.
git-svn-id: https://develop.svn.wordpress.org/trunk@49026 602fd350-edb4-49c9-b593-d223f7449a82
These actions allow debugging tools to track `WP_Error` instances as they're created and subsequently passed between functions which check for error objects.
Props Shelob9, Mte90, TimothyBlynJacobs, johnbillion
Fixes#40568
git-svn-id: https://develop.svn.wordpress.org/trunk@49022 602fd350-edb4-49c9-b593-d223f7449a82
This brings continuity to all the image related functions and filters which accept or pass a size parameter.
Props dilipbheda, johnbillion
Fixes#47364
git-svn-id: https://develop.svn.wordpress.org/trunk@49021 602fd350-edb4-49c9-b593-d223f7449a82
This ensures the correct data properties are checked before displaying image thumbnails.
Props chetan200891
Fixes#49655
git-svn-id: https://develop.svn.wordpress.org/trunk@49012 602fd350-edb4-49c9-b593-d223f7449a82
This brings theme deletion inline with plugin deletion and theme and plugin editing, which can only be performed from within Network Admin.
Props Mista-Flo, williampatton, johnbillion
Fixes#41441
git-svn-id: https://develop.svn.wordpress.org/trunk@49011 602fd350-edb4-49c9-b593-d223f7449a82
Transitioning posts from `auto-draft` to `publish` via `wp_publish_post()` could result in published posts without the default category or custom taxonomy default terms.
Props frank-klein, TimothyBlynJacobs, peterwilsoncc.
Fixes#51292.
git-svn-id: https://develop.svn.wordpress.org/trunk@49000 602fd350-edb4-49c9-b593-d223f7449a82
This avoids the performance overhead of calling `WP_Comment_Query::get_comments()` twice: first when creating the object instance, then to retrieve the filtered results.
This also makes the filter a bit more consistent with other similar filters, e.g. `posts_pre_query`, `terms_pre_query`, or `users_pre_query`.
Follow-up to [46086].
Props dinhtungdu, imath, spacedmonkey, adamsilverstein, SergeyBiryukov.
Fixes#50521.
git-svn-id: https://develop.svn.wordpress.org/trunk@48990 602fd350-edb4-49c9-b593-d223f7449a82
In grid view, contextually generated or cropped media is filtered out causing page numbering to be offset and incorrect. This also impacted any media utilizing `media-models.js`.
Props webmandesign, audrasjb, afercia, pbiron, mista-flo.
Fixes#46127, #50410, #47215.
git-svn-id: https://develop.svn.wordpress.org/trunk@48989 602fd350-edb4-49c9-b593-d223f7449a82
The filter should return the network count as an integer if `$this->query_vars['count']` is set.
Follow-up to [46100].
See #50768, #47599.
git-svn-id: https://develop.svn.wordpress.org/trunk@48984 602fd350-edb4-49c9-b593-d223f7449a82
Previously, the attribute could unintentionally be added to a tag that starts with the same characters, e.g. `<aside>` instead of `<a>`.
Props antonlukin.
Fixes#51313.
git-svn-id: https://develop.svn.wordpress.org/trunk@48983 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a fatal error on PHP 8 caused by passing mismatched arguments to `vsprintf()`, and maintains the current behaviour.
Follow-up to [48979], [48980].
See #50913, #50639.
git-svn-id: https://develop.svn.wordpress.org/trunk@48981 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a fatal error on PHP 8 caused by passing a non-string value to ` mysqli_real_escape_string()`, and maintains the current behaviour.
See #50913, #50639.
git-svn-id: https://develop.svn.wordpress.org/trunk@48980 602fd350-edb4-49c9-b593-d223f7449a82
This has a considerable performance impact on sites which don't otherwise show previous and next post links, and has no SEO benefit.
Props joostdevalk, swissspidy, johnbillion
Fixes#39111
git-svn-id: https://develop.svn.wordpress.org/trunk@48966 602fd350-edb4-49c9-b593-d223f7449a82
The `wp_mail()` function has the ability to add attachments to emails. There is currently no way to add attachments to the recovery mode email sent out to site admins when a PHP error is encountered on their site.
This change adds that ability through the use of the `recovery_mode_email` filter, allowing developers to use the full capabilities of `wp_mail()`.
Props desrosj, timothyblynjacobs.
Fixes#51276.
git-svn-id: https://develop.svn.wordpress.org/trunk@48964 602fd350-edb4-49c9-b593-d223f7449a82
The admin menu icons are included as a visual element to support the text links. Without the `aria-hidden=“true”` attribute, they are also exposed to assistive technologies (which can process icon fonts in unpredictable ways).
This change improves the experience for multiple types of assistive technologies, including screen reading and voice control software. With `aria-hidden=“true”` added, the icons will not be read, and a user can now trigger a click of a top level admin menu item with commands such as “click posts”, or “click plugins”.
Props joedolson, afercia, audrasjb, adriantirusli.
Fixes#51012.
git-svn-id: https://develop.svn.wordpress.org/trunk@48963 602fd350-edb4-49c9-b593-d223f7449a82
This fixes a PHP 8 "argument must be passed by reference, value given" error when using `array_map( 'get_comment', ... )`.
Object variables in PHP 5+ contain a reference to the object, and it's the reference that's passed around.
Note: This reverts [48838], which is now redundant.
Follow-up to a similar change for `get_post()` in [21572].
See #50913.
git-svn-id: https://develop.svn.wordpress.org/trunk@48961 602fd350-edb4-49c9-b593-d223f7449a82
PHP 8 changes the way string to number comparisons are performed: https://wiki.php.net/rfc/string_to_number_comparison
In particular, checking if an empty string is less than zero in PHP 8 evaluates to `true`, not `false`.
For `WP_Query`, this resulted in unintentionally returning a 404 error for most of front-end requests, instead of the relevant content.
By explicitly casting the value to `int`, we make sure to compare both values as numbers, rather than a string and a number.
Follow-up to [38288].
Props trepmal.
See #50913.
git-svn-id: https://develop.svn.wordpress.org/trunk@48960 602fd350-edb4-49c9-b593-d223f7449a82
This method is useful whenever a JSON Schema needs to be converted to a format suitable for argument validation with `WP_REST_Request`. Moving the logic into a standalone function allows developers to use it outside of the `WP_REST_Controller` context.
Props pentatonicfunk.
Fixes#50876.
git-svn-id: https://develop.svn.wordpress.org/trunk@48951 602fd350-edb4-49c9-b593-d223f7449a82
#50244 aims to introduce batch processing in the REST API. An important feature is the ability to enforce that all requests have valid data before executing the route callbacks in "pre-validate" mode.
This necessitates splitting `WP_REST_Server::dispatch()` into two methods so the batch controller can determine the request handler to perform pre-validation and then respond to the requests.
The two new methods, `match_request_to_handler` and `respond_to_request`, have a public visibility, but are marked as `@access private`. This is to allow for iteration on the batch controller to happen in the Gutenberg repository. Developers should not rely upon these methods, their visibility may change in the future.
See #50244.
Props andraganescu, zieladam, TimothyBlynJacobs.
git-svn-id: https://develop.svn.wordpress.org/trunk@48947 602fd350-edb4-49c9-b593-d223f7449a82
Most request data is validated on a per-parameter basis. Often, however, additional validation is needed that operates on the entire request object. Currently, this is done in the route callback and often in the `prepare_item_for_database` method specifically.
#50244 aims to introduce batch processing in the REST API. An important feature is the ability to enforce that all requests have valid data before executing the route callbacks in "pre-validate" mode.
This patch introduces support for calling a `validate_callback` after all parameter validation has succeeded. That allows moving more validation outside of the route callback and into `WP_REST_Request` which will improve "pre-validate" support.
Props TimothyBlynJacobs, zieladam.
Fixes#51255.
See #50244.
git-svn-id: https://develop.svn.wordpress.org/trunk@48945 602fd350-edb4-49c9-b593-d223f7449a82
This better reflects the purpose of the method, which doesn't have anything to do with a comment status.
Follow-up to [48521].
Props davidbaumwald, johnbillion, SergeyBiryukov.
Fixes#51248.
git-svn-id: https://develop.svn.wordpress.org/trunk@48943 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that the filter is only applied if the conditions before it are evaluated to true.
Follow-up to [48714].
Props johnbillion.
See #50768.
git-svn-id: https://develop.svn.wordpress.org/trunk@48942 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a conflict with the same global variable used elsewhere, e.g. in Theme Editor.
Follow-up to [48850].
Props vinayak.anivase.
Fixes#51219.
git-svn-id: https://develop.svn.wordpress.org/trunk@48938 602fd350-edb4-49c9-b593-d223f7449a82
The recommended approach for any plugins using these globals or properties is to switch to the newer `wp.i18n` functions.
In the meantime, this ensures that accessing any of these globals does not break the rest of the code on the page, and an appropriate warning message is logged to the JavaScript console.
Follow-up to: https://core.trac.wordpress.org/query?summary=~wp.i18n&milestone=5.5
Props omarreiss, peterwilsoncc, kbjohnson90, johnbillion, TimothyBlynJacobs, joostdevalk, ocean90, desrosj, SergeyBiryukov.
Fixes#51123.
git-svn-id: https://develop.svn.wordpress.org/trunk@48923 602fd350-edb4-49c9-b593-d223f7449a82
Additionally, simplify the `$format` argument checks for consistency with similar checks in `get_the_modified_date()` and `get_the_modified_time()`.
Follow-up to [48912].
Props Rarst.
See #51184.
git-svn-id: https://develop.svn.wordpress.org/trunk@48918 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that the data for the currently installed theme is picked up properly when uploading a theme update on Windows.
Follow-up to [48390].
Props bobbingwide, wpamitkumar, mukesh27.
Fixes#51182.
git-svn-id: https://develop.svn.wordpress.org/trunk@48913 602fd350-edb4-49c9-b593-d223f7449a82
Technically, the `$format` argument should always be a string, but passing `false` used to work before [47808], so this restores backward compatibility.
The list of affected functions:
* `get_the_date()`
* `get_the_time()`
* `get_comment_date()`
* `get_comment_time()`
Props wittich, Rarst, akabarikalpesh, SergeyBiryukov.
Fixes#51184.
git-svn-id: https://develop.svn.wordpress.org/trunk@48912 602fd350-edb4-49c9-b593-d223f7449a82
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
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