Commit Graph

2357 Commits

Author SHA1 Message Date
Aaron D. Campbell
742d7e6663 Strip control characters before validating redirect.
Merges [40183] to 4.7 branch.



git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40184 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-06 13:39:33 +00:00
Dominik Schilling (ocean90)
a2c633fdc7 REST API: Allow setting post formats even if they are not supported by the theme.
A `post_format` not used by the current theme, but supported by core is not a wrong/broken piece of information. It's just not used at this point in time. Therefore we should allow setting and retrieving any of the standard post formats supported in core, even if the current theme doesn't use them.

After this commit, a post's `format` value can survive a round trip through the API, which is a good general design principle for an API.

Merge of [40120] and [40121] to the 4.7 branch.

Props JPry, iseulde, davidakennedy, Drivingralle.
Fixes #39232.

git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40137 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-27 20:02:43 +00:00
Dominik Schilling (ocean90)
6bfb976577 REST API: Fix behavior of sticky posts filter when no posts are sticky.
Previously, when getting posts from the API with `sticky=true`, if there were no sticky posts set, the query would return all posts  as if the `sticky` argument was not set.  In this situation, the query should return an empty array instead.

A `sticky=true` query that should return an empty array (in the previous situation, or with `include` and no intersecting post IDs) was also broken in that it would query the post with ID 1.

Finally, this commit significantly improves test coverage for the `sticky` filter argument, including direct testing of the `WHERE` clauses generated by `WP_Query`.

Merge of [40037] and [40122] to the 4.7 branch.

Props ryelle, jnylen0.
See #39079.
Fixes #39947.

git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40136 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-27 19:53:43 +00:00
Joe McGill
260f39ea0f Media: Reset Exif orientation after rotate in WP_Image_Editor_Imagick.
Due to inconsistencies in the way browsers handle Exif orientation data,
if a user manually rotates an image within WordPress, set the Exif orientation to
the default (1) so that the image displays with the same rotation/flip in every browser.

Props sanchothefat, triplejumper12, joemcgill, azaozz, markoheijnen, mikeschroder.
Merges [40123] and [40129] to the 4.7 branch.
Fixes #37140. See #14459.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40135 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-27 19:32:45 +00:00
Joe McGill
f055694b32 Media: Reduce failing uploads following 4.7.1.
[39831] introduced more strict MIME type checking for uploads, which
resulted in unintetionally blocking several filetypes that were
previously valid. This change uses a more targeted approach to MIME
validation to restore previous behavior for most types.

Props blobfolio, iandunn, ipstenu, markoheijnen, xknown, joemcgill.
Merges [40124] and [40125] to the 4.7 branch.
Fixes #39550, #39552.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40134 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-27 19:27:58 +00:00
Joe McGill
9cf5b91e9c Media: Keep PDF previews from overwriting files.
Since support for PDF previews were added in [38949], it's possible
that the generated image file could overwrite an existing image file
with the same name. This uses wp_unique_filename() to avoid this
issue and adds a '-pdf' identifier on the end of filenames.

Props gitlost, desrosj, mikeschroder, joemcgill.
Merges [40130] and [40131] to the 4.7 branch.
Fixes #39875. See #31050.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40133 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-27 19:24:50 +00:00
Sergey Biryukov
44c58d1a12 REST API: JavaScript client - improve route discovery for custom namespaces.
Fix parsing of custom namespace routes. Transform class names, removing dashes and capitalizing each word/route part so a route path of `widgets/recent-posts` becomes a collection with the name `WidgetsRecentPosts`. Correct parent route part when routes are longer than expected, reversing parse direction.

Props westonruter, jazbek, adamsilverstein, jnylen0.
Merges [40074] and [40109] to the 4.7 branch.
Fixes #39561.

git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40117 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-24 22:47:47 +00:00
Sergey Biryukov
dbf739bbaa REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.

The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.

Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.

Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.

Props jnylen0, welcher, adamsilverstein, netweb, ocean90, rachelbaker.
Merges [40058], [40061], [40065], [40066], [40077], and [40104] to the 4.7 branch.
Fixes #39264.

git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40116 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-24 22:33:05 +00:00
Sergey Biryukov
9afe01b087 REST API: Shim post_date_gmt for drafts / empty dates in the REST API.
Internally, WordPress uses a special `post_date_gmt` value of `0000-00-00 00:00:00` to indicate that a draft's date is "floating" and should be updated whenever the post is saved. This makes it much more difficult for API clients to know the correct date of a draft post.

This commit provides a best guess at a `date_gmt` value for draft posts in this situation using the `date` field and the site's current timezone offset.

Props joehoyle, jnylen0.
Merges [40108] to the 4.7 branch.
Fixes #38883.

git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40115 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-24 22:02:48 +00:00
Sergey Biryukov
9c7ef6a3ad REST API: Fix multiple issues with setting dates of posts and comments.
This commit modifies the `rest_get_date_with_gmt` function to correctly parse local and UTC timestamps with or without timezone information.

It also ensures that the REST API can edit the dates of draft posts by setting the `edit_date` flag to `wp_update_post`.

Overall this commit ensures that post and comment dates can be set and updated as expected.

Props jnylen0.
Merges [40101] to the 4.7 branch.
Fixes #39256.

git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40114 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-24 21:58:07 +00:00
Sergey Biryukov
32ccf017de REST API: Correctly parse body parameters for DELETE requests.
DELETE was inadvertently omitted from the list of non-POST HTTP methods that should be able to accept body parameters. Parameters passed to DELETE requests as JSON are already parsed correctly; this commit fixes application/x-www-form-urlencoded parameters as well.

Props mnelson4.
Merges [40105] to the 4.7 branch.
Fixes #39933.

git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40113 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-24 20:56:00 +00:00
Sergey Biryukov
caebbb456e REST API: Do not allow access to users from a different site in multisite.
It has been unintendedly possible to both view and edit users from a different site than the current site in multisite environments. Moreover, when passing roles to a user in an update request, that user would implicitly be added to the current site.

This changeset removes the incorrect behavior for now in order to be able to provide a proper REST API workflow for managing multisite users in the near future. Related unit tests have been adjusted as well.

Props jnylen0, jeremyfelt, johnjamesjacoby.
Merges [40106] to the 4.7 branch.
Fixes #39701.

git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40111 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-24 20:45:52 +00:00
Dion Hulse
809c9d5b7a 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.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40099 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-21 07:02:14 +00:00
Dion Hulse
bce41a8435 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.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40098 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-21 07:01:07 +00:00
Dion Hulse
28bcb22f2f 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.



git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40091 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-21 03:41:42 +00:00
Dion Hulse
1109726f83 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.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40088 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-20 06:49:11 +00:00
Dion Hulse
af53eecf76 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.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40085 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-20 06:37:22 +00:00
Dion Hulse
8531c4e5a6 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.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40083 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-20 06:15:07 +00:00
Rachel Baker
72294c9caa 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.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40081 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-19 04:35:28 +00:00
Rachel Baker
7be9593b68 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.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40078 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-19 03:18:38 +00:00
Dion Hulse
a345f95664 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.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40071 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-17 06:46:45 +00:00
Dion Hulse
7759f06d5f 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.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40069 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-17 05:06:23 +00:00
Boone Gorges
4bc40bf97b 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.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39993 602fd350-edb4-49c9-b593-d223f7449a82
2017-01-26 16:56:21 +00:00
Dominik Schilling (ocean90)
c9cd77ce11 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.

git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39957 602fd350-edb4-49c9-b593-d223f7449a82
2017-01-26 13:46:54 +00:00
Joe McGill
5e7d198785 Tests: Replace broken codeispoetry.png file.
This also updates the test filename in
`WP_Test_REST_Attachments_Controller::test_create_item_default_filename_title()`
to accurately match the actual file name.

Merges [39848] to the 4.7 branch.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39849 602fd350-edb4-49c9-b593-d223f7449a82
2017-01-11 16:27:17 +00:00
Aaron D. Campbell
8214df823f 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.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39844 602fd350-edb4-49c9-b593-d223f7449a82
2017-01-11 14:48:04 +00:00
Dion Hulse
ae00aedc60 Customize: Ensure theme_mod-cache of custom_css lookup of -1 short-circuits a WP_Query from being made.
Props dlh, westonruter.
See #35395.
Merges [39688] to the 4.7 branch.
Fixes #39259.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39694 602fd350-edb4-49c9-b593-d223f7449a82
2017-01-05 08:14:56 +00:00
Boone Gorges
a428ffc53d Ignore the 'comment_order' setting when determining comment pagination.
[38740] incorrectly introduced logic that changed a comment's page when
'comment_order' was set to 'desc'. This is in violation of the design
of the comment pagination system: a comment's page is designed not to
change when 'comment_order' or 'default_comment_page' are changed.
See #31101.

Merges [39663] to the 4.7 branch.

Props rachelbaker.
Fixes #39280.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39664 602fd350-edb4-49c9-b593-d223f7449a82
2017-01-02 20:06:59 +00:00
Rachel Baker
7b4f4be327 REST API: Allow schema sanitization_callback to be set to null to bypass fallback sanitization functions.
The logic in WP_REST_Request->sanitize_params() added in [39091] did not account for `null` or `false` being the sanitization_callback preventing overriding `rest_parse_request_arg()`. This fixes that oversight, allowing the built in sanitization function to be bypassed. See #38593.

Merges [39563] to the 4.7  branch.

Props kkoppenhaver, rachelbaker, jnylen0.
Fixes #39042.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39642 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-27 17:48:10 +00:00
Gary Pendergast
82af7aba8d Media: Allow PDF fallbacks filter to process custom sizes.
This fixes an oversight in [39246], which added a hook for filtering the array of sizes used for PDF thumbnails, but failed to provide a way for sizes added through `add_image_size()` to be processed.

Merge of [39617] to the 4.7 branch.

Props gitlost.
Fixes #39231. See #38594.



git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39633 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-21 05:52:54 +00:00
Gary Pendergast
81cc13dd49 REST API: Fix PHP warnings when get_theme_support( 'post-formats' ) is not an array.
If `add_theme_support( 'post-formats' )` is called with no additional arguments, then `get_theme_support( 'post-formats' )` returns `true` rather than an array of supported formats. Avoid generating PHP warnings in this situation.

Merge of [39620] to the 4.7 branch.

Props dreamon11, ChopinBach.
Fixes #39293.



git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39630 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-21 05:29:24 +00:00
Gary Pendergast
fab33a89e5 REST API: Add support for filename search in media endpoint.
In [38625], the functionality to search for attachments by filename was added via the `posts_clauses` filter and the `_filter_query_attachment_filenames()` function. This moves `_filter_query_attachment_filenames()` from `wp-admin/includes/post.php` to `wp-includes/post.php` so that it can be applied in the same manner in the REST API media endpoint.

Merge of [39598] to the 4.7 branch.

Props jblz, tyxla.
Fixes #39092.



git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39629 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-21 05:18:24 +00:00
Gary Pendergast
092fa83f60 REST API: Allow sending an empty or no-op comment update.
In general, updates that don't actually change anything should succeed. [39371] added tests for other object types, and this commit fixes empty updates for comments and adds the missing test.

Merges [39597] to the 4.7 branch.

Props jnylen0.
Fixes #38700.



git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39628 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-21 05:12:06 +00:00
Gary Pendergast
ef084ac427 Tests: Restore the database connection earlier when switching test groups.
When plugins don't disable the `backupGlobals` PHPUnit option in their own tests, `$wpdb` is backed up and restored between classes of tests. The serialisation process used for this broke the database connection. This previously wasn't a problem, as it was reconnecting before each test.

[38398] introduced some changes that required the connection to be available in `setUpBeforeClass()`, earlier than in was previously reconnecting. This didn't cause warnings in Core, but it did cause warnings for plugins that don't disable the `backupGlobals` option.

The database connection now reconnects in `setUpBeforeClass()`. This change also fixes a few Core tests that weren't calling `parent::setUpBeforeClass()` or `parent::tearDown()` correctly.

Merges [39626] to the 4.7 branch.

Fixes #39327.



git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39627 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-21 05:07:05 +00:00
Dion Hulse
7e49d80783 Feeds: Do not translate the lastBuildDate field in RSS feeds.
Props stevenkword.
Partial Merge of [39613] to the 4.7 branch.
Fixes #39141.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39615 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-16 06:43:48 +00:00
Dion Hulse
2e6ae93cf2 Taxonomy: Restore the ability to use string-based $args in wp_get_object_terms().
Props tyxla.
Merges [39578] to the 4.7 branch.
Fixes #39215.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39611 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-16 05:49:02 +00:00
Dion Hulse
8cbd30e3ce REST API: Do not include the password argument when getting media items
Currently, `attachment` is the only post type exposed via the REST API that
does not support password protection, but it's possible for other post types to
remove password support.

Props jnylen0.
Merges [39595] to the 4.7 branch.
Fixes #38977.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39610 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-16 05:45:50 +00:00
Dion Hulse
321599cc46 REST API: Do not error on empty JSON body
It's fairly common for clients to send `Content-Type: application/json` with an
empty body.  While technically not valid JSON, we've historically supported
this behaviour, so it shouldn't cause an error.

Props JPry, jnylen0.
Merges [39594] to the 4.7 branch.
Fixes #39150.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39609 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-16 05:42:23 +00:00
Dion Hulse
4d3fb455f5 Posts, Post Types: Ensure is_page_template() can only return true when viewing a singular post query.
Props natereist, dlh, johnbillion.
Merges [39599] to the 4.7 branch.
Fixes #39211.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39608 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-16 05:40:01 +00:00
Dion Hulse
c41a10ecb1 PDF Images: Avoid a PHP Warning when attempting to process a file without an extension.
Props chandrapatel for initial patch.
Merges [39580] to the 4.7 branch.
Fixes #39195.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39607 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-16 05:38:41 +00:00
Dion Hulse
46611f6153 De-Emphasise the minor (x.y.Z) version in readme.html by including only the major version for the 4.7 branch.
See #35554


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39582 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 07:59:10 +00:00
Dion Hulse
26caea9b90 Customize: Deprecate page_home nav menu item starter content in favor of home_link; replace usage in Twenty Seventeen.
Props celloexpressions, westonruter.
See #38615, #38114, [38991].
Merges [39561] to the 4.7 branch.
Fixes #39104.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39575 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 02:24:19 +00:00
Dion Hulse
5fa5e22427 Customize: Trim whitespace for URLs supplied for external_header_video to prevent esc_url_raw() from making them invalid.
Props tyxla.
See #38172.
Merges [39560] to the 4.7 branch.
Fixes #39125.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39573 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 02:05:22 +00:00
Dion Hulse
620d169b35 Customize: Prevent single quotes (apostrophes) in custom_css values from unexpectedly causing false positives for unbalanced character validation errors.
Props westonruter.
See #39218, #35395.
Merges [39559] to the 4.7 branch.
Fixes #39198.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39567 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 01:44:26 +00:00
Dion Hulse
0087500d9c REST API: Treat any falsy value as false in 'rest_allow_anonymous_comments'.
Extend the check in 'rest_allow_anonymous_comments' to accept any falsy value (previously this was an explicit check for `false`).

One possible failure case is that a plugin developer forgets to include a return value for some code path in their callback for this filter, leading to a value of null which is currently treated like `true`.

Props joehoyle, jnylen0.
Merges [39487] to the 4.7 branch.
Fixes #39010.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39566 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 01:39:13 +00:00
Weston Ruter
cee7b15ead Customize: Defer populating post_name for auto-draft posts in customized state until posts are published.
The ultimate `post_name` is stored in postmeta until the post is published. The `get_page_by_path()` function does not exclude `auto-draft` posts. Revert changes to `wp_unique_post_slug()` from [39411] which excluded `auto-draft` posts.

Props westonruter, dlh for testing, helen for testing.
Merges [39506] onto 4.7 branch.
Fixes #39078 for 4.7.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39507 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-05 19:38:16 +00:00
Andrew Nacin
afca2c6cf0 Build/Test Tools: Specify exact node version in package.json.
Enforce it in the tests.

Merges [39478] to the 4.7 branch.

see #35105, #38657.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39480 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-04 17:37:38 +00:00
Weston Ruter
98b7307e75 Customize: Ensure a custom_css post insertion gets an initial post revision.
Merges [39477] onto 4.7 branch.
Props georgestephanis, westonruter.
Fixes #39032 for 4.7.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39479 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-04 17:31:28 +00:00
Andrew Nacin
3bcc86a908 REST API: Register the admin_email setting in single site only.
Merges [39470] and [39471] to the 4.7 branch.

fixes #38990.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39472 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-03 05:41:52 +00:00
Gary Pendergast
3b3a0f0a68 REST API: Site URL setting should not be present on multisite installations.
The `siteurl` setting is registered and made available to the REST API. On a multisite installation, this setting is not configurable from the General Settings screen, but due to the above it is configurable from the REST API.

Merge of [39468] to the 4.7 branch.

Props peterwilsoncc.
Fixes #39005.



git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39469 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-03 05:17:26 +00:00