2880 Commits

Author SHA1 Message Date
Sergey Biryukov
845f569b46 Tests: Use DIR_TESTDATA in test_wp_set_script_translation().
`__DIR__` is not available in PHP 5.2.x.

See #45103.

git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43828 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-26 03:54:02 +00:00
herregroen
4f05bb81f6 I18N: Add JavaScript translation support.
Adds the `wp_set_script_translations` function which registers translations for a JavaScript file. This function takes a handle, domain and optionally a path and ensures JavaScript translation files are loaded if they exist.

Props atimmer, omarreiss, nerrad, swissspidy, ocean90.
Fixes #45103.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43825 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-25 13:59:51 +00:00
Aaron Jorbin
5a3ad21aeb php7.3 compatibility: Fix compact throwing notices
In PHP 7.3, the compact() function has been changed to issue an E_NOTICE level error if a passed string refers to an unset variable. In previous versions of PHP, this notice was silently skipped. The full RFC can be viewed here: https://wiki.php.net/rfc/compact

This fixes all unit tested code that uses compact.

Props desrosj.
Fixes #44416.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43819 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-24 16:32:29 +00:00
Gary Pendergast
52beb9c65d KSES: Allow the download attribute on <a> tags.
To avoid this being a vector for bypassing the filetypes that are allowed to be uploaded, this attribute is only allowed to be added without a value.

Props kalpshit, arshidkv12, welcher, peterwilsoncc, marina_wp, pento.
See #44724.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43813 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-24 01:18:38 +00:00
Gary Pendergast
2bfffb3e1c Styles: Add helper functions for loading block styles.
Blocks are able to register styles that used in the editor and the frontend, or only in the editor. These functions ensure the correct styles are loaded in the correct place.

See #45065.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43812 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-24 00:35:51 +00:00
Daniel Bachhuber
dfbe885115 Meta: Allow empty strings to be set by Custom Fields meta box.
Because the REST API allows meta keys to have empty values, the Custom Fields meta box should permit the same behavior.

Props charlestonsw, soulseekah.
Fixes #43559.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43811 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-23 18:55:45 +00:00
Daniel Bachhuber
8c0b678862 Embeds: Filter HTML response in oEmbed proxy controller.
Adapts the response from `WP_oEmbed_Controller::get_proxy_item()` so that the response is correctly filtered and embeds work properly in JavaSccript editors. Introduces new `get_oembed_response_data_for_url()` function for preparing internal oEmbed responses.

Props danielbachhuber, imath, swissspidy.
Fixes #45142. 


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43810 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-23 17:47:28 +00:00
Aaron Jorbin
51d04a18dc Bundled Theme: Make twentynineteen the default theme.
After [43808], we can now make twentynineteen the default theme. Twentyseventeen has been a great default, but 5.0 and twentynineteen is guten.

Fixes #45152.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43809 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-23 16:50:33 +00:00
Gary Pendergast
9811439172 REST API: Add endpoints for blocks.
`WP_REST_Block_Renderer_Controller` allows rendering of server-side rendered blocks, whilst `WP_REST_Blocks_Controller` allows retrieving of reusable blocks.

Props desrosj, danielbachhuber, pento.
See #45065.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43805 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-23 07:03:47 +00:00
Gary Pendergast
2b18dcdecd Blocks: Add the reusable block post type, wp_block.
See #45098.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43804 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-23 06:52:03 +00:00
Gary Pendergast
ff39bf3d68 Build: Update the @wordpress/editor package.
The `@wordpress/editor` wasn't upgraded to the correct version in [43789].

This commit includes changes from the `@wordpress/block-library` upgrade in [43789], that weren't copied to the correct location in core.

This also regenerates the `package-lock.json` in Linux, which the build server requires.

See #45145.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43801 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-23 05:34:43 +00:00
Daniel Bachhuber
443771e51b Themes: Introduce responsive embeds support.
Responsive embeds is a way for a theme to opt in to WordPress dynamically scaling the width/height of an embed. When a theme supports responsive embeds, a `wp-embed-responsive` class is added to the `<body>` tag. This information is also presented through the REST API for clients to respect.

Props desrosj.
Fixes #45125.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43790 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-22 19:57:07 +00:00
Gary Pendergast
91f1b57473 Script/Style Dependencies: Make sure that inline scripts for handles without a source are printed.
See [36550] for `WP_Styles`.

Merges [43565] to the 5.0 branch.

Props bpayton.
Fixes #44551.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43788 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-22 06:12:55 +00:00
Gary Pendergast
0dffb08553 KSES: Allow url() to be used in inline CSS.
The cover image block uses the `url()` function in its inline CSS, to show the cover image. KSES didn't allow this, causing the block to not save correctly for Author and Contributor users. As KSES does already check each attribute name against an allowed list, we're able to add an extra check for certain attributes to be able to use the `url()` function, too.

Props peterwilsoncc, azaozz, pento, dd32.
See #45067.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43781 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-22 04:03:07 +00:00
Sergey Biryukov
48ae93d41e REST API: Restore Autosaves controller test for multisite.
PHPUnit 3.6.x requires `exclude` and `file` paths to be relative to the checkout root.

PHPUnit 4.0.0+ requires the paths to be relative to the configuration file.

See #45131.

git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43774 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-20 04:20:58 +00:00
Daniel Bachhuber
7eeb2e599e REST API: Handle api-request query parameters with plain permalinks.
When constructing the request URL, ensure that `?` is replaced with `&` when the API root already contains a `?`. Fixes an issue where requests were broken when sites had permalinks set to plain.

Props aduth.
Merges [42965] to the 5.0 branch.
Fixes #42382.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43771 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-19 18:32:03 +00:00
Daniel Bachhuber
e9613346e6 REST API: Include block_version on Post content object.
The `block_version` denotes which version of Blocks the `post_content` contains. Introduces new `block_version()` function for versioning Blocks.

Props danielbachhuber, birgire.
Fixes #43887.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43770 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-19 17:57:38 +00:00
Daniel Bachhuber
523213aa06 REST API: Skip Autosaves controller test for multisite.
There's some PHP 5.2 (cough, cough) edge case where paths calculated differently, possibly caused by differing version of PHPUnit.

See #45132, #45131, #43316.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43769 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-19 14:08:12 +00:00
Daniel Bachhuber
ef67f4ad75 REST API: Introduce Autosaves controller and endpoint.
* Adds `WP_REST_Autosaves_Controller` which extends `WP_REST_Revisions_Controller`.
* Autosaves endpoint is registered for all post types except `attachment` because even post types without revisions enabled are expected to autosave.
* Because setting the `DOING_AUTOSAVE` constant pollutes the test suite, autosaves tests are run last. We may want to improve upon this later.

Props adamsilverstein, aduth, azaozz, danielbachhuber, rmccue.
Fixes #43316.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43768 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-19 13:48:42 +00:00
Daniel Bachhuber
e8eabb8583 REST API: Use a truly impossibly high number in User Controller tests.
The `100` number could be valid in certain test run configurations. The `REST_TESTS_IMPOSSIBLY_HIGH_NUMBER` constant is impossibly high for this very reason.

Fixes #45128.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43767 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-19 11:56:20 +00:00
Daniel Bachhuber
60b2d59358 REST API: Ensure rest_url() consistently has leading slash.
`rest_url()` inconsistent addes slashes to the passed path depending on whether the site has pretty permalinks enabled. Apart from being inconsistent, this also caused the unit tests to fail when pretty permalinks are enabled.

Props frank-klein.
Merges [42250] to the 5.0 branch.
Partially reverts [43720].
Fixes #42452. See #41451, #45017.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43766 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-19 11:13:57 +00:00
Gary Pendergast
88fbc8f35d REST API: Introduce the rest_preload_api_request() function.
This function helps perform multiple REST API requests, for the purpose of preloading data into a page.

See #45110.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43763 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-19 08:56:58 +00:00
Gary Pendergast
3ba1a2b33c Block Editor: Add helper functions for displaying the editor.
`use_block_editor_for_post()` and `use_block_editor_for_post_type()` determine if the block editor should be loaded.

`get_block_categories()` and `get_block_editor_server_block_settings()` provide data be included while the block editor is loading.

See #45110.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43762 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-19 08:43:25 +00:00
Daniel Bachhuber
111a9eaaf9 REST API: Correct HTTP status code in error for requests to create a duplicate term.
The 409 error code is intended for situations where it is expected that the user will resolve the conflict and resubmit the same request. We use 400 error codes for other routes when a duplicate request is made. The 400 status code tells the user they need to modify their request for it to be successful.

Props shooper.
Merges [42354] to the 5.0 branch.
Fixes #42781. See #41370.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43756 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-18 20:31:58 +00:00
Gary Pendergast
36cc615d15 Blocks: Parse blocks when displaying posts.
Posts containing blocks are now correctly handled when displaying on the front end, including dynamic blocks and nested blocks.

See #45109.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43752 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-18 11:53:49 +00:00
Gary Pendergast
570fc2a5b0 Blocks: Introduce the block parser.
The `WP_Block_Parser` class, and the accompanying `parse_blocks()` helper function, can be used to parse an array of blocks out of a content string.

`WP_Block_Parser` is copied from the `@wordpress/block-serialization-default-parser` package. To ensure it stays in sync with the JavaScript parser, changes should be implemented in the package first, then the package version should be upgraded to include the changes.

See #45109.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43751 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-18 04:39:40 +00:00
Sergey Biryukov
dcb3ac99b9 General: PHP 7.3 throws an E_WARNING when using continue to target a switch.
Applying continue to a switch is equivalent to using break and quite possibly, a continue targeting a higher level control structure is actually intended.

To target the higher level control structure, a numeric argument has to be passed to continue. This fixes two cases in WordPress Core where this is currently happening.

See: https://github.com/php/php-src/pull/3364
See: https://wiki.php.net/rfc/continue_on_switch_deprecation

Props jrf.
Merges [43653] to the 5.0 branch.
Fixes #44543.

git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43746 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-18 03:41:46 +00:00
Gary Pendergast
7ae9e6abdd Blocks: Introduce register_block_type(), unregister_block_type(), and get_dynamic_blocks() functions.
These helper functions allow easy access to the global block registry.

See #45109.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43743 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-18 01:52:58 +00:00
Gary Pendergast
15b8548ca0 Blocks: Introduce WP_Block_Type and WP_Block_Type_Registry classes.
These are the foundational classes allowing blocks to be registered and used throughout WordPress.

This commit also includes the `has_block()` and `has_blocks()` functions, which are required for unit testing these classes.

Props adamsilverstein, danielbachhuber, desrosj.
See #45097, #45109.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43742 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-18 01:30:49 +00:00
K. Adam White
5b45675d59 REST API: Slash existing meta values when comparing with incoming meta upates.
When comparing the old and new values for a meta key being set, ensure both values are sanitized using the same logic so that equal values match.

props boonebgorges, dcavins, MattGeri, pilou69, TimothyBlynJacobs.
Fixes #42069.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43740 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-17 20:09:33 +00:00
Daniel Bachhuber
22d106805f REST API: Introduce controller for searching across post types.
Introduces a `WP_REST_Search_Controller` class which registers a `/wp/v2/search` endpoint. Search types are handled by extending `WP_REST_Search_Handler`. The default search type is `WP_REST_Post_Search_Handler` but can be filtered by plugins or a theme.

Props danielbachhuber, flixos90, pento, rmccue.
Fixes #39965.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43739 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-17 17:02:04 +00:00
Anton Timmermans
5e0814148e Script loader: Adjust JS packages registration.
Adjusts the packages registration after [43723]:

* Combine the different registration functions into one
`wp_default_packages` function. To reach this goal move the prefix
logic into a function so it can be called from different locations.
Use a `static` variable there to prevent duplicate inclusion of
`version.php`.
* Call this function from the `wp_default_scripts` action by
registering it as a default filter.
* Combine some of the logic in `_WP_Editors::print_tinymce_scripts`
into `wp_register_tinymce_scripts`. The logic to force an uncompressed
TinyMCE script file stays in `_WP_Editors::force_uncompressed_tinymce`
because that logic is very specific to the classic editor.
* The script handle `wp-tinymce` is now a dependency of the `editor`
script handle. In combination with the previous item, this makes the
classic editor work.
* Adjust the syntax of the script paths to be more consistent with
other WordPress code.
* Always use `"production"` mode for the media files to prevent people
from inadvertently committing development files.

Props pento, omarreiss.
Fixes #45065.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43738 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-17 15:28:33 +00:00
Daniel Bachhuber
5773ee93e5 REST API: Don't add fields to object when not included in ?_fields=.
In [43087], we improved REST API performance by only rendering the fields specified in the request. Similarly, any fields registered with `register_rest_field()` should only be rendered when included in `?_fields=`.

Props dlh.
Fixes #45099.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43736 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-17 02:40:23 +00:00
K. Adam White
95bfae3200 REST API: Add new class file and tests missed in [43734].
See #45016.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43735 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-16 22:49:59 +00:00
K. Adam White
ca79cbbca7 REST API: Introduce themes endpoint to expose theme-supports values for the active theme.
In order to correctly render parts of its UI, the new editor needs to be aware of the active theme's post-formats and post-thumbnails support. This data is exposed by querying for the active theme on a new /wp/v2/themes endpoint for sufficiently privileged users.

props desrosj.
Fixes #45016.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43734 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-16 22:27:05 +00:00
Peter Wilson
51d8512f8d Formatting: Add new tests missed in [43732].
Completes merging [42770] to the 5.0 branch.
See #43187.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43733 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-16 04:41:45 +00:00
Peter Wilson
6d417d937d Formatting: Add pre-save content filter to make target=_blank always secure.
Props notnownikki, iseulde, azaozz.
Merges [42770] to the 5.0 branch.
Fixes #43187.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43732 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-16 04:12:21 +00:00
Felix Arntz
b0cd1e010f REST API: Move object type-specific metadata integrations from the wrapper functions to the low-level Meta API functions.
Object type-specific actions that should happen before or after modification of metadata have so far been part of the respective wrapper functions. By using action and filter hooks, this changeset ensures they are always executed, even when calling the lower-level Meta API functions directly, which the REST API does as a prime example.

Props flixos90, spacedmonkey.
Fixes #44467.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43729 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-15 11:45:16 +00:00
Peter Wilson
c4052edfe9 KSES: Allow HTML data-* attributes.
Add global support for HTML attributes prefixed `data-` for authors and contributors, as required by the new editor.

Props azaozz, peterwilsoncc.
Fixes #33121.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43727 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-15 05:21:04 +00:00
Daniel Bachhuber
d7f287b50b REST API: Include permalink_template/generated_slug for Posts
In order for clients to present permalink previews, the REST API must share the computed results of `get_sample_permalink()`. These two values are now exposed as `permalink_template` and `generated_slug` for public, viewable post types, but only for `context=edit`.

Props danielbachhuber, rahulsprajapati.
Fixes #45017.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43720 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-11 22:24:51 +00:00
Sergey Biryukov
b513113c49 REST API: Support pagination, order, search and other common query parameters for revisions.
The original REST API revisions controller relied on `wp_get_post_revisions()`, getting all revisions of a post without any possibility to restrict the result. This changeset replaces that function call with a proper `WP_Query` setup, replicating how `wp_get_post_revisions()` works while offering parameters to alter the default behavior.

Props adamsilverstein, birgire, flixos90.
Merges [43584-43586], [43647] to the 5.0 branch.
Fixes #40510.

git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43716 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-11 07:15:34 +00:00
Sergey Biryukov
184cf32e34 REST API: Pass correct ID to meta->update_value to permit setting term meta during term creation.
Props joehoyle.
Merges [43636] to the 5.0 branch.
Fixes #44834.

git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43714 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-11 06:34:34 +00:00
Sergey Biryukov
0df2b51e80 Tests: Improve coverage for REST API term meta registration.
Introduce tests to validate that register_meta and register_term_meta work as expected in WP_REST_Terms_Controller.

Props timmydcrawford.
Merges [43567] to the 5.0 branch.
Fixes #39122.

git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43713 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-11 06:31:43 +00:00
Sergey Biryukov
3b405ba347 Taxonomy: Make sure wp_list_categories() correctly outputs term name of 0.
Props joyously, SergeyBiryukov.
Merges [43605] to the 5.0 branch.
Fixes #44872.

git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43712 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-11 04:41:39 +00:00
Sergey Biryukov
c95bf0c377 Tests: Introduce Tests_HTTP_Functions::skipTestOnTimeout(), mirroring the same WP_HTTP_UnitTestCase method.
Merges [43512] to the 5.0 branch.
Fixes #44613.

git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43696 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-11 03:19:47 +00:00
Sergey Biryukov
f489011a90 Tests: Use WP_HTTP_UnitTestCase::skipTestOnTimeout() in more HTTP tests.
Adjust it to handle more types of timeouts, e.g. "Resolving timed out", "Connection timed out".

Merges [43511] to the 5.0 branch.
See #44613.

git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43695 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-11 03:17:44 +00:00
Daniel Bachhuber
f5c8be7077 REST API: Enable users with read_private_posts to query for them.
An authorized request with the `read_private_posts` capability for a post type should be able to `GET /wp/v2/posts` for posts of `status=private`. This query is further sanity-checked by `WP_REST_Posts_Controller->check_read_permission()`, which is unchanged.

Props rachelbaker, soulseekah, twoelevenjay.
Fixes #43701.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43694 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-10 20:48:21 +00:00
Daniel Bachhuber
d3488487cd REST API: Declare unfiltered_html capability in links.
Because user capabilities can be modified at runtime, the REST API needs to expose them in some evaluated but declarative manner for clients to interpret. JSON Hyper Schema `targetSchema` provides an appropriate paradigm for doing so.

Props timothyblynjacobs.
Fixes #45014.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43682 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-08 22:44:05 +00:00
Daniel Bachhuber
9dd758a32d REST API: Persist attributes for attachment links
In [43437], the link definition implementation caused attachment links to be unexpectedly nested under an `attributes` key. This changeset restores the prior behavior.

Props TimothyBlynJacobs.
Fixes #44750.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43681 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-08 18:18:25 +00:00
Daniel Bachhuber
ccf66142cc REST API: Define taxonomy visibility settings in schema
For Gutenberg and other admin-type interfaces, it's
useful to be able to see the visibility settings for
taxonomies.

The original changeset was partially included in [43445].

Merges [42729], [42730], [42973] to the 5.0 branch.
Props joehoyle, TimothyBlynJacobs, pento.
Fixes #42707


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43680 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-08 13:49:51 +00:00