Commit Graph

36182 Commits

Author SHA1 Message Date
Dion Hulse
876e894635 Customize: Extend auto-draft life of a customize_changeset post whenever modified.
Keep bumping the date for the auto-draft to preserve it from garbage-collection via `wp_delete_auto_drafts()` after 7 days.

Props westonruter.
Merges [40041] to the 4.7 branch.
See #30937.
Fixes #39713.

Built from https://develop.svn.wordpress.org/branches/4.7@40099


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40036 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 07:03:34 +00:00
Dion Hulse
02789248ca Customize: Allow custom post types to be used in starter content.
Changes `WP_Customize_Nav_Menus::insert_auto_draft_post()` so it can be invoked for a `post_type` that is not registered (yet).

Props westonruter.
Merges [39924] to the 4.7 branch.
See #38615, #38114.
Fixes #39610.

Built from https://develop.svn.wordpress.org/branches/4.7@40098


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40035 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 07:02:34 +00:00
Dion Hulse
f5b00a1534 Customize: Ensure edit shortcuts get re-created for nested partials when a parent partial is refreshed.
Fixes issue where the edit shortcut for a nav menu gets dropped when the containing Custom Menu widget is updated.

Props westonruter.
Merges [40055] to the 4.7 branch.
See #39101.
Fixes #39353.

Built from https://develop.svn.wordpress.org/branches/4.7@40097


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 06:59:31 +00:00
Dion Hulse
bade579fc3 Customize: Skip intercepting non-HTTP(S) links in customizer preview just as jump links are ignored.
Ensures that links with `javascript:`, `mailto:` and other protocols work as expected in the customizer preview.

Props westonruter.
Merges [40064] to the 4.7 branch.
Fixes #39797.

Built from https://develop.svn.wordpress.org/branches/4.7@40096


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 06:56:34 +00:00
Dion Hulse
de7de0a0d6 Customize: Always enqueue customize-preview stylesheet in the customizer preview to style selective refresh and visual edit shortcuts.
Enqueues the style along with the `customize-preview` script in the manager instead of via the `widgets` and `nav_menus` components, ensuring that the stylesheet is loaded for users who cannot manage widgets or nav menus.

Props dlh, westonruter.
Merges [39951] to the 4.7 branch.
See #27403.
Fixes #39498.

Built from https://develop.svn.wordpress.org/branches/4.7@40095


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 06:54:35 +00:00
Dion Hulse
a0edd9b006 Customize: Trim whitespace from nav menu item titles so that the underlying object's original title appears as input placeholder and in the control's title.
Whitespace is trimmed from titles in PHP when saved in any case, so this aligns the client-side behavior with what happens on the server.

Amends [38618].
Merges [39994] to the 4.7 branch.
See #38015.
Fixes #39600.

Built from https://develop.svn.wordpress.org/branches/4.7@40094


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 06:52:35 +00:00
Dion Hulse
2a891e4456 Customize: Update customize.php URL with changeset_uuid param the instant a change is made instead of deferring until the changeset update request responds.
Props asalce, westonruter.
Merges [39686] to the 4.7 branch.
Fixes #39227.

Built from https://develop.svn.wordpress.org/branches/4.7@40093


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 06:50:41 +00:00
Dion Hulse
d1b2273838 Menus: Prevent notice thrown in class-walker-page.php.
Calling `Walker_Page::walk()` directly was causing an `Undefined index: item_spacing` notice to be thrown, this adds an `isset()` check to prevent it.

Props bhargavbhandari90, peterwilsoncc.
Merges [39949] to the 4.7 branch.
Fixes #39564.

Built from https://develop.svn.wordpress.org/branches/4.7@40092


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 03:51:35 +00:00
Dion Hulse
e18e5acce8 Formatting: fix wpautop() to stop adding paragraph tags around <figcaption>.
Props azaozz, pbearne for tests.
Merges [39912], [39914] to the 4.7 branch.
Fixes #39307 for 4.7.


Built from https://develop.svn.wordpress.org/branches/4.7@40091


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40028 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 03:42:38 +00:00
Sergey Biryukov
f65de13e9f About page: Remove autoplay and loop attributes on "Theme Starter Content", "Edit Shortcuts", and "Video Headers" videos, originally added as a part of [39512].
For UX and accessibility reasons, it's better to always avoid playing videos automatically.

Props bor0.
Merges [40089] to the 4.7 branch.
Fixes #39560.
Built from https://develop.svn.wordpress.org/branches/4.7@40090


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-20 13:09:34 +00:00
Dion Hulse
6e1fe24284 Customize: Ensure root values are accessible in multidimensional custom setting types.
Fixes bad conditions in `WP_Customize_Setting::get_root_value()` and `WP_Customize_Setting::set_root_value()`.

Props dlh, westonruter.
Amends [35007].
Merges [40036] to the 4.7 branch.
See #32103.
Fixes #36952.

Built from https://develop.svn.wordpress.org/branches/4.7@40088


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40025 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-20 06:50:50 +00:00
Dion Hulse
bc0cb365a3 Customize: Introduce get_header_video_url filter for the return value of get_header_video_url().
Props sanket.parmar, celloexpressions, SergeyBiryukov.
Merges [40045], [40086] to the 4.7 branch.
Fixes #39512.

Built from https://develop.svn.wordpress.org/branches/4.7@40087


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-20 06:49:53 +00:00
Dion Hulse
6f0ebaba78 Feeds: Prevent empty feeds from returning 404 errors.
Partial revert of [38929].

This reverts the source code from the commit for #30210 to prevent valid but empty feeds from returning 404 file not found errors for the home and custom feeds.

The tests in the commit that remain applicable are retained.

Props pavelevap for reporting, stevenkword for initial patch, peterwilsoncc.
See #30210.
Merges [40030] to the 4.7 branch.
Fixes #39157.

Built from https://develop.svn.wordpress.org/branches/4.7@40085


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40022 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-20 06:38:48 +00:00
Dion Hulse
cb22496f4c REST API: JavaScript client should use _.extend when merging objects.
Correct an issue during the client's dynamic route discovery in `wp.api.utils.decorateFromRoute` where `_.union` potentially failed if used on objects.

Props ketuchetan, adamsilverstein.
Merges [40040] to the 4.7 branch.
Fixes #39341.

Built from https://develop.svn.wordpress.org/branches/4.7@40084


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-20 06:35:48 +00:00
Dion Hulse
5789e5f074 Taxonomy: Disallow overriding the name property when registering a taxonomy.
Props wpfo for initial patch, swissspidy.
Merges [40049] to the 4.7 branch.
Fixes #39308.

Built from https://develop.svn.wordpress.org/branches/4.7@40083


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-20 06:16:53 +00:00
Rachel Baker
2dda813ae2 REST API: Include the status property in view context responses from the Posts endpoints.
Previously the status for a Post (or other post_types) was only exposed under the `edit` context, which doesn't really make much sense considering we support querying by post status without authentication. Originally introduced in v2.0 beta 1: 69f617d749 without any explanation in the commit message.

Props dhanendran, jnylen0, rachelbaker.
Merges [40080] to the 4.7 branch.
Fixes #39466.

Built from https://develop.svn.wordpress.org/branches/4.7@40081


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-19 04:36:32 +00:00
Rachel Baker
4bd52ccd1d REST API: Correctly serve the index with PATH_INFO
When hitting the index, `untrailingslashit()` would make the REST route empty, which would then use the fallback inside WP_REST_Server. This isn't a problem most of the time, but WP_REST_Server contains a fallback to PATH_INFO. Combined with PATH_INFO permalinks, this would give a 404 on the API index, as it attempts to look up a route for "/wp-json/".

Props ccprog.
Merges [39923] to the 4.7 branch.
Fixes #39432.

Built from https://develop.svn.wordpress.org/branches/4.7@40079


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40016 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-19 03:28:34 +00:00
Rachel Baker
a51de29064 REST API: Cast revision author ID to int.
The `post_author` field is a string internally, but we need to cast it to an integer in the REST API. This was already done for posts, but not for revisions. The field is already declared as an integer in both controllers.

Props jnylen0.
Merges [40063] to the 4.7 branch.
Fixes #39871.

Built from https://develop.svn.wordpress.org/branches/4.7@40078


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-19 03:19:37 +00:00
Sergey Biryukov
c884f781e1 Media: In wp_unique_filename(), use explicit type casting when incrementing $number.
This prevents the "non-numeric value encountered" warning in PHP 7.1, caused by trying to increment an empty string on the first loop iteration.

Props drrobotnik for initial patch.
Merges [40039] to the 4.7 branch.
Fixes #39774.
Built from https://develop.svn.wordpress.org/branches/4.7@40075


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-17 21:24:35 +00:00
Dion Hulse
297220b740 Media: Avoid PHP Warnings in get_post_galleries() when processing empty [gallery] shortcodes and avoid returning the incorrect results when the global $post does not match the provided post ID.
Props dd32, joemcgill, seanchayes.
Merges [40070] to the 4.7 branch.
Fixes #39277, #39304.

Built from https://develop.svn.wordpress.org/branches/4.7@40071


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-17 06:47:34 +00:00
Dion Hulse
1ffeb0f19f HTTP API: Restore backwards compatibility with the http_api_curl filter - it expects that the handle parameter is passed as a reference, however [39212] missed that.
Props pento.
Merges [40068] to the 4.7 branch.
Fixes #39783.

Built from https://develop.svn.wordpress.org/branches/4.7@40069


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-17 05:07:33 +00:00
Aaron Campbell
aa89522a9b Post-4.7.2 version bump for 4.7 branch.
Built from https://develop.svn.wordpress.org/branches/4.7@40018


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-26 21:58:35 +00:00
Aaron Campbell
665617103b Fix version to 4.7.2 not 4.7.3.
Built from https://develop.svn.wordpress.org/branches/4.7@39997


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-26 18:19:35 +00:00
Aaron Campbell
befa21d88e Bump 4.7 branch to version 4.7.2.
Built from https://develop.svn.wordpress.org/branches/4.7@39995


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-26 18:14:35 +00:00
Boone Gorges
89d7d9e70f Revert to pre-4.7 behavior for fetching object instances by id.
This changeset reverts [38381], which caused inconsistencies in the way the
REST API fetches posts and other objects.

Merge of [39992] to the 4.7 branch.

See #38792, #37738.

Built from https://develop.svn.wordpress.org/branches/4.7@39993


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-26 16:57:32 +00:00
John Blackbourn
fa47298720 Posts, Post Types: When using Excerpt mode on the Posts list table, ensure the excerpt output matches what was manually entered into the Excerpt field.
Merges [39956] to the 4.7 branch.

Built from https://develop.svn.wordpress.org/branches/4.7@39990


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-26 15:12:34 +00:00
Dominik Schilling
ad0f68291a Press This: Do not show Categories & Tags UI for users who cannot assign terms to posts anyways.
Merge of [39968] to the 4.7 branch.
Built from https://develop.svn.wordpress.org/branches/4.7@39969


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-26 14:01:34 +00:00
Dominik Schilling
599e703836 REST API: Unify object access handling for simplicity.
Rather than repeating ourselves, unifying the access into a single method keeps everything tidy. While we're at it, add in additional schema handling for common parameters.

Merge of [39954] to the 4.7 branch.

See #38792.
Built from https://develop.svn.wordpress.org/branches/4.7@39957


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-26 13:47:34 +00:00
Dominik Schilling
5960939cca Query: Ensure that queries work correctly with post type names with special characters.
Merge of [39952] to the 4.7 branch.
Built from https://develop.svn.wordpress.org/branches/4.7@39953


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-26 13:36:37 +00:00
Aaron Campbell
7b45f8189d Post-4.7.1 version bump for 4.7 branch.
Built from https://develop.svn.wordpress.org/branches/4.7@39883


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-11 21:36:35 +00:00
Aaron Campbell
281e5e828a Only show major version in readme.html for 4.7 branch
Built from https://develop.svn.wordpress.org/branches/4.7@39871


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-11 17:46:33 +00:00
Joe McGill
0df6499c8d Media: Fix exif_imagetype check in wp_get_image_mime
This is a follow up to [39831].

Merges [39850] to the 4.7 branch.

Built from https://develop.svn.wordpress.org/branches/4.7@39851


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-11 16:38:32 +00:00
Aaron Campbell
5094cbd599 Bump 4.7 branch to version 4.7.1.
Built from https://develop.svn.wordpress.org/branches/4.7@39845


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-11 15:15:35 +00:00
Aaron Campbell
39b785c7f9 REST API: Change which users are shown in the users endpoint.
Only show users that have authored a post of a post type that has `show_in_rest` set to true.

Props rachelbaker, jnylen0.
Merges [39843] to 4.7 branch.

Built from https://develop.svn.wordpress.org/branches/4.7@39844


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-11 14:49:33 +00:00
Joe McGill
75df12f322 Media: Improve image filetype checking.
This adds a new function `wp_get_image_mime()` which is used by
`wp_check_filetype_and_ext()` to validate image files using
`exif_imagetype()` if available instead of `getimagesize()`.

`getimagesize()` is less performant than `exif_imagetype()` and is
dependent on GD. If `exif_imagetype()` is not available, it falls back to
`getimagesize()` as before.

If `wp_check_filetype_and_ext()` can't validate the filetype, we now return
`false` for ext/MIME values.

Merges [39831] to the 4.7 branch.

Built from https://develop.svn.wordpress.org/branches/4.7@39832


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-11 13:12:34 +00:00
Dominik Schilling
3176a085da Updates: Translate plugin data on the Updates screen.
Merge of [39808] to the 4.7 branch.
Built from https://develop.svn.wordpress.org/branches/4.7@39820


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-11 11:39:34 +00:00
Dominik Schilling
e0b6a13194 Themes: Fix markup for theme name fallbacks.
Merge of [39807] to the 4.7 branch.
Built from https://develop.svn.wordpress.org/branches/4.7@39809


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-11 11:08:37 +00:00
Jeremy Felt
871bb10c9a Multisite: Use wp_rand() in signup key creation.
Merges [39795] to the 4.7 branch.

Built from https://develop.svn.wordpress.org/branches/4.7@39796


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-11 05:31:35 +00:00
Dion Hulse
31c9a63bfb Update PHPMailer to 5.2.22.
The full list of changes is available here:
https://github.com/PHPMailer/PHPMailer/compare/v5.2.21...v5.2.22

Merges [39759] to the 4.7 branch.
Fixes #37210 for 4.7.

Built from https://develop.svn.wordpress.org/branches/4.7@39783


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-11 05:21:59 +00:00
Jeremy Felt
63828d08a0 Mail: Disable wp-mail.php when mailserver_url is mail.example.com.
Merges [39772] to the 4.7 branch.

Built from https://develop.svn.wordpress.org/branches/4.7@39773


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-11 05:15:34 +00:00
Aaron Campbell
189e5449a3 Add nonce for widget accessibility mode.
Props vortfu.

See #23328.

Merges [39760] to 4.7 branch.

Built from https://develop.svn.wordpress.org/branches/4.7@39761


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-11 01:40:34 +00:00
Aaron Campbell
d47305bfe4 Add -src back to version
Built from https://develop.svn.wordpress.org/branches/4.7@39750


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-06 23:04:36 +00:00
Aaron Campbell
aa13103db8 Post 4.7.1-RC1 version bump
Built from https://develop.svn.wordpress.org/branches/4.7@39749


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-06 22:44:35 +00:00
Aaron Campbell
3027491963 WordPress 4.7.1-RC1
Built from https://develop.svn.wordpress.org/branches/4.7@39746


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-06 22:16:57 +00:00
Aaron Campbell
ed77d76855 Twenty Seventeen: add more details about filter and requires version
The required version should be 4.7 and also adds more information to changelog.

Props @ocean90 @Presskopp

Merges [39744] to 4.7 branch.


Built from https://develop.svn.wordpress.org/branches/4.7@39745


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-06 22:16:24 +00:00
Aaron Campbell
483fa89c88 Twenty Seventeen: version bump and update changelog
Adds in changelog since last version and all the changes listed in readme.txt.
Bumps version numbers in style.css and readme.txt.

Props @ocean90

Merges [39742] to the 4.7 branch.


Built from https://develop.svn.wordpress.org/branches/4.7@39743


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-06 22:15:10 +00:00
Dominik Schilling
95026e579b Twenty Seventeen: Introduce a theme-specific filter twentyseventeen_starter_content for customizing the starter content array.
Add some documentation to the default starter content.

Merge of [39720] to the 4.7 branch.

Props sanket.parmar, celloexpressions.
See #39109.
Built from https://develop.svn.wordpress.org/branches/4.7@39721


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-06 22:03:30 +00:00
Dion Hulse
425d389d92 Upgrade/Install: Avoid creating nonce during installation.
When installing and using database-saved salts, wp_create_nonce() causes database errors as wp_salt() attempts to insert into the not-yet-created options table. Since authentication isn't available during installation, we can safely skip creating a nonce.

Props nullvariable, pento, dd32, rmccue.
Merges [39684] to the 4.7 branch.
Fixes #39047.

Built from https://develop.svn.wordpress.org/branches/4.7@39697


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-05 08:18:37 +00:00
Dion Hulse
6cdd4b1250 Customize: Prevent removal of underline upon hover/focus for nav menu deletion links.
Props monikarao.
Amends [38503].
See #37527.
Merges [39677] to the 4.7 branch.
Fixes #39444.

Built from https://develop.svn.wordpress.org/branches/4.7@39696


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-05 08:17:37 +00:00
Dion Hulse
4a804cac79 Customize: Remove extra left padding in core for site title and widgets in preview.
These styles should only be applied by theme stylesheets as needed.

Props sirbrillig.
Reverts parts of [39202] and [39233].
See #38651.
Merges [39685] to the 4.7 branch.
Fixes #39349.

Built from https://develop.svn.wordpress.org/branches/4.7@39695


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-05 08:16:39 +00:00