Comment and term meta lazyloading for `WP_Query` loops, introduced in 4.4,
depended on filter callback methods belonging to `WP_Query` objects. This meant
storing `WP_Query` objects in the `$wp_filter` global (via `add_filter()`),
requiring that PHP retain the objects in memory, even when the local variables
would typically be expunged during normal garbage collection. In cases where a
large number of `WP_Query` objects were instantiated on a single pageload,
and/or where the contents of the `WP_Query` objects were quite large, serious
performance issues could result.
We skirt this problem by moving metadata lazyloading out of `WP_Query`. The
new `WP_Metadata_Lazyloader` class acts as a lazyload queue. Query instances
register items whose metadata should be lazyloaded - such as post terms, or
comments - and a `WP_Metadata_Lazyloader` method will intercept comment and
term meta requests to perform the cache priming. Since `WP_Metadata_Lazyloader`
instances are far smaller than `WP_Query` (containing only object IDs), and
clean up after themselves far better than the previous `WP_Query` methods (bp
only running their callbacks a single time for a given set of queued objects),
the resource use is decreased dramatically.
See [36525] for an earlier step in this direction.
Props lpawlik, stevegrunwell, boonebgorges.
Fixes#35816.
git-svn-id: https://develop.svn.wordpress.org/trunk@36566 602fd350-edb4-49c9-b593-d223f7449a82
- Cache the output in non-persistent cache.
- Cache the result from `wp_mkdir_p()` in persistent cache (when present).
- Introduce `wp_get_upload_dir()` for use when not uploading files. It is equivalent to `wp_upload_dir()` but does not check for the existence or create the upload directory.
- Change tests to use the non-cached `_wp_upload_dir()`. They change options on the fly (should never be used in production) to simulate different environments.
- Introduce `_upload_dir_no_subdir()` and `_upload_dir_https()` to facilitate testing. These use the proper `upload_dir` filter to simulate different environments.
Props kovshenin, azaozz.
See #34359.
git-svn-id: https://develop.svn.wordpress.org/trunk@36565 602fd350-edb4-49c9-b593-d223f7449a82
Introduces language files in /tests/phpunit/data/language. Each file includes the header and 5 translations.
Props realloc for initial patch.
Fixes#35284.
git-svn-id: https://develop.svn.wordpress.org/trunk@36563 602fd350-edb4-49c9-b593-d223f7449a82
The `network_site_new_form` action can be used to extend the new site form.
Props igmoweb, ocean90.
Fixes#34739.
git-svn-id: https://develop.svn.wordpress.org/trunk@36555 602fd350-edb4-49c9-b593-d223f7449a82
- Restore loading order for wp-admin: open-sans, dashicons, etc.
- Remove couple of redundant dependencies.
See #35229.
git-svn-id: https://develop.svn.wordpress.org/trunk@36551 602fd350-edb4-49c9-b593-d223f7449a82
This prevents breaking plugins which are adding inline styles to the `wp-admin` handle after [36341].
Props dd32, ocean90.
Fixes#35229.
git-svn-id: https://develop.svn.wordpress.org/trunk@36550 602fd350-edb4-49c9-b593-d223f7449a82
Backbone, from 1.1.2 to 1.2.3. Underscore, from 1.6.0 to 1.8.3.
The new versions of Backbone and Underscore offer numerous small bug fixes and some optimizations and other improvements. Check the [http://backbonejs.org/#changelog Backbone changelog] and [http://underscorejs.org/#changelog Underscore changelog] for the full details.
The new versions include some significant changes that may break existing code. Plugins or themes that rely on the bundled Backbone and/or Underscore libraries should carefully check functionality with the latest versions and run any available unit tests to ensure compatibility.
Some changes of note that were addressed in core as part of this upgrade:
* `_.flatten` no longer works with objects since Underscore.js 1.7. `_.flatten()` working with objects was an unintended side-affect of the implementation, see [https://github.com/jashkenas/underscore/issues/1904#issuecomment-60241576 underscore#1904]. Check any `_flatten` usage and only flatten arrays.
* As of Backbone 1.2.0, you can no longer modify the `events` hash or your view's `el` property in `initialize`, so don't try to modify them there.
* Since Underscore 1.7, Underscore templates no longer accept an initial data object. `_.template` always returns a function now so make sure you use it that way.
Props adamsilverstein.
Fixes#34350.
git-svn-id: https://develop.svn.wordpress.org/trunk@36546 602fd350-edb4-49c9-b593-d223f7449a82
Use the parameter for the deprecated constructor warning in `WP_Widget` to provide an indication to which widget is using the PHP4 style constructor.
Props sebastian.pisula.
Fixes#33440.
git-svn-id: https://develop.svn.wordpress.org/trunk@36541 602fd350-edb4-49c9-b593-d223f7449a82
Prevents missing header images when an image has the same name as another header image.
Props sirbrillig.
Fixes#31786.
git-svn-id: https://develop.svn.wordpress.org/trunk@36539 602fd350-edb4-49c9-b593-d223f7449a82
In `get_translations_for_domain()` don't fill the global `$l10n` with `NOOP_Translations` instances, return a `NOOP_Translations` instance instead.
Props nacin, jrf.
Fixes#21319.
git-svn-id: https://develop.svn.wordpress.org/trunk@36538 602fd350-edb4-49c9-b593-d223f7449a82
HEAD callbacks can now be registered independently, with the GET
callback still used as a fallback.
Fixes#34841.
git-svn-id: https://develop.svn.wordpress.org/trunk@36535 602fd350-edb4-49c9-b593-d223f7449a82
CURIEs are Compact URIs, which provide a more usable way to use
custom relations in the API. The `wp` CURIE is registered by default
for `https://api.w.org/` URI relations.
Fixes#34729.
Props joehoyle.
git-svn-id: https://develop.svn.wordpress.org/trunk@36533 602fd350-edb4-49c9-b593-d223f7449a82
Introduces `WP_Customize_Manager::get_previewable_devices()` with a `customize_previewable_devices` filter to change the default device and which devices are available for previewing. This is a feature that was first pioneered on WordPress.com.
Props celloexpressions, folletto, valendesigns, westonruter, welcher, adamsilverstein, michaelarestad, Fab1en.
Fixes#31195.
git-svn-id: https://develop.svn.wordpress.org/trunk@36532 602fd350-edb4-49c9-b593-d223f7449a82
Uses `wp_debug_mode()` to prevent response from being broken by debug errors. Matches similar behavior of the XML-RPC API.
Props rockwell15.
Fixes#34915.
git-svn-id: https://develop.svn.wordpress.org/trunk@36530 602fd350-edb4-49c9-b593-d223f7449a82
This allows using rest_do_request() outside of the API itself easily.
Props danielbachhuber, swissspidy.
git-svn-id: https://develop.svn.wordpress.org/trunk@36529 602fd350-edb4-49c9-b593-d223f7449a82
Also, tries to use the new grays from the Design Handbook wherever applicable.
Props michaelarestad, afercia.
Fixes#35604.
git-svn-id: https://develop.svn.wordpress.org/trunk@36528 602fd350-edb4-49c9-b593-d223f7449a82
This new action gives developers a place to output content at the beginning
of the form element on edit-tags.php.
Props flixos90.
Fixes#35252.
git-svn-id: https://develop.svn.wordpress.org/trunk@36526 602fd350-edb4-49c9-b593-d223f7449a82
Taxonomies registered as `publicly_queryable` can be queried as taxonomy
archives.
If not provided explicitly, the value of `publicly_queryable` is inherited
from `public`.
Props Chouby.
Fixes#34491.
git-svn-id: https://develop.svn.wordpress.org/trunk@36525 602fd350-edb4-49c9-b593-d223f7449a82
Lazyloading for comment meta and term meta, introduced into `WP_Query` in
4.4, used flags - `updated_term_meta_cache` and `updated_comment_meta_cache` -
in an attempt to prevent cache priming from happening more than once per query
object. This technique was mostly effective, but not entirely efficient, since
the flag didn't prevent the `lazyload_*_meta` callbacks from running. The
obvious solution - removing the filter callback after it'd be run once - was
dismissed for 4.4 because of concerns that `remove_filter()` could disable
lazyloading too generally in the context of nested queries, due to the way
`_wp_filter_build_unique_id()` doesn't always build sufficiently unique IDs for
similar objects. However, further testing shows that this concern is only valid
in a very small subset of cases, while the cost of keeping the query objects in
memory, via the `$wp_filter` global, is quite significant. As such, this
changeset removes the flags in favor of the `remove_filter()` technique.
See #35454, #35816.
git-svn-id: https://develop.svn.wordpress.org/trunk@36524 602fd350-edb4-49c9-b593-d223f7449a82
When the same nav menu is shown multiple times on a page, only the first instance of the nav menu will include `id` attributes. Subsequent instances will have the `id` attributes omitted. However, in both cases the underlying nav menu item's post ID is available among the `class` names, so the post ID can be more reliably obtained from `class` instead of the `id` attribute.
Amends [36383].
Fixes#32681.
git-svn-id: https://develop.svn.wordpress.org/trunk@36523 602fd350-edb4-49c9-b593-d223f7449a82
Hide the re-order button if there are no widgets in the sidebar, or if there is there is only one sidebar and there is only one widget in the sidebar.
Props rabmalin, westonruter.
Fixes#35533.
git-svn-id: https://develop.svn.wordpress.org/trunk@36522 602fd350-edb4-49c9-b593-d223f7449a82
The date within the comments list table “Submitted On” column will only be wrapped in `get_comment_link()` if the comment is approved and associated with a valid `comment_post_ID`.
Fixes#35279.
git-svn-id: https://develop.svn.wordpress.org/trunk@36521 602fd350-edb4-49c9-b593-d223f7449a82