Commit Graph

541 Commits

Author SHA1 Message Date
Sergey Biryukov
eccc31aadf Block Editor: Prevent the meta box form from being accidentally submitted.
Meta boxes are loaded inside a wrapper form, that the block editor submits as part of the saving process. It shouldn't be submitted manually.

Props pento.
Merges [43880] to trunk.
Fixes #45284.
Built from https://develop.svn.wordpress.org/trunk@44240


git-svn-id: http://core.svn.wordpress.org/trunk@44070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 03:17:56 +00:00
Jeremy Felt
7ffb7340f5 Editor: Cast the result of the default_content, default_title, and default_excerpt filters.
If a plugin returns a non-string value (or returns `null`) on these filters, it can cause errors in the block editor. Casting them as a string prevents these errors.

Merges [43858] from the 5.0 branch to trunk.

Props dd32.
See #45236.

Built from https://develop.svn.wordpress.org/trunk@44224


git-svn-id: http://core.svn.wordpress.org/trunk@44054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 03:04:29 +00:00
Jeremy Felt
c92118203b Block Editor: Don't show back compat or incompatible meta boxes in Options.
Meta boxes that exist for back compat, or that are incompatible with the block editor aren't displayed, so they don't need an option to display or hide them in the Options dialog.

Merges [43856] from the 5.0 branch to trunk.

Props noisysocks.
Fixes #45249.

Built from https://develop.svn.wordpress.org/trunk@44222


git-svn-id: http://core.svn.wordpress.org/trunk@44052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 03:02:46 +00:00
atimmer
a603510b73 Build Tools: Upgrade @wordpress packages to the latest version.
This also includes the new @wordpress/format-library and @wordpress/notices packages.

package-lock.json has been completely regenerated in this commit.

Props pento.
Merges [43840] to trunk.
See #45145.

Built from https://develop.svn.wordpress.org/trunk@44177


git-svn-id: http://core.svn.wordpress.org/trunk@44007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 10:55:01 +00:00
desrosj
dd7e2243fa 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, danielbachhuber.

Merges [43811] to trunk.

Fixes #43559.
Built from https://develop.svn.wordpress.org/trunk@44153


git-svn-id: http://core.svn.wordpress.org/trunk@43983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 03:17:38 +00:00
Jeremy Felt
fe31e0adc5 Meta Boxes: Sync checks for valid meta boxes from do_meta_boxes() to the_block_editor_meta_boxes().
Merges [43792] from the 5.0 branch to trunk.

Props ocean90.
See #45112.

Built from https://develop.svn.wordpress.org/trunk@44141


git-svn-id: http://core.svn.wordpress.org/trunk@43971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 01:56:17 +00:00
Gary Pendergast
a119d4561e Block Editor: Add helper functions to collect meta box information.
To allow the block editor to render meta boxes, it needs to collect information about how those meta boxes are registered, and format it for the block editor to make use of.

Merges [43778] from the 5.0 branch to trunk.

See #45112.


Built from https://develop.svn.wordpress.org/trunk@44131


git-svn-id: http://core.svn.wordpress.org/trunk@43961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 01:11:37 +00:00
desrosj
85eb073748 i18n: Remove some translation domains accidentally included in [43762], [44122].
Moves [43764] to trunk.

Fixes #45110.
Built from https://develop.svn.wordpress.org/trunk@44124


git-svn-id: http://core.svn.wordpress.org/trunk@43954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-13 22:26:27 +00:00
desrosj
13226b445e 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.

Props pento.

Merges [43762] to trunk.

See #45110.
Built from https://develop.svn.wordpress.org/trunk@44122


git-svn-id: http://core.svn.wordpress.org/trunk@43952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-13 22:25:11 +00:00
John Blackbourn
47d32decd6 Docs: Correct and improve various inline documentation.
See #42505

Built from https://develop.svn.wordpress.org/trunk@43582


git-svn-id: http://core.svn.wordpress.org/trunk@43411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-27 14:28:26 +00:00
Gary Pendergast
56c162fbc9 Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.


Built from https://develop.svn.wordpress.org/trunk@43571


git-svn-id: http://core.svn.wordpress.org/trunk@43400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-17 01:51:36 +00:00
Andrew Ozz
06725cf28d Move scheduling of old auto-draft posts deletion to get_default_post_to_edit() (where auto-drafts are created).
Fixes #44337.
Built from https://develop.svn.wordpress.org/trunk@43338


git-svn-id: http://core.svn.wordpress.org/trunk@43166 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-06-28 02:26:22 +00:00
Andrew Ozz
3266b10d04 Privacy: add "Mine" filter for media similarly to posts and comments.
Props audrasjb.
See #43820.
Built from https://develop.svn.wordpress.org/trunk@43056


git-svn-id: http://core.svn.wordpress.org/trunk@42885 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-01 15:43:22 +00:00
John Blackbourn
b13e73d05c Docs: Document more parameters and properties using typed array notation.
See #41756

Built from https://develop.svn.wordpress.org/trunk@42875


git-svn-id: http://core.svn.wordpress.org/trunk@42705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-25 18:10:32 +00:00
Gary Pendergast
aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


Built from https://develop.svn.wordpress.org/trunk@42343


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Gary Pendergast
c90cfa3b50 General: Fix some precision alignment formatting warnings.
The WPCS `WordPress.WhiteSpace.PrecisionAlignment` rule throws warnings for a bunch of code that will likely cause issues for `wpcbf`. Fixing these manually beforehand gives us better auto-fixed results later.

See #41057.


Built from https://develop.svn.wordpress.org/trunk@42228


git-svn-id: http://core.svn.wordpress.org/trunk@42057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-26 23:57:55 +00:00
Boone Gorges
2322b40358 Introduce meta_box_sanitize_cb taxonomy argument.
The `meta_box_cb` argument was introduced in [25572] to allow plugin
authors to provide a custom callback for rendering their taxonomy's meta
box on the post edit screen. However, the routine used to handle the saving
of these custom taxonomy meta boxes was not customizable, but was instead
based simply on whether the taxonomy was hierarchicaly. See [13535].

The new `meta_box_sanitize_cb` argument defaults to the "tag" routine for
non-hierarchical taxonomies and the "category" routine for hierarchical ones,
thereby maintaining the current default behavior. Developers can override this
when the data passed from their `meta_box_cb` differs.

Props boonebgorges, ZaneMatthew, stephenharris.
Fixes #36514.
Built from https://develop.svn.wordpress.org/trunk@42211


git-svn-id: http://core.svn.wordpress.org/trunk@42040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-21 03:15:50 +00:00
Sergey Biryukov
af4cda27cc Posts, Post Types: Simplify the wording in post locking notice.
Props munyagu.
Fixes #42023.
Built from https://develop.svn.wordpress.org/trunk@41706


git-svn-id: http://core.svn.wordpress.org/trunk@41540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-03 15:11:48 +00:00
Sergey Biryukov
3d26fab9f6 Post Formats: In bulk_edit_posts(), set post format before the post is updated, for consistency with edit_post().
This makes sure that plugins hooked to `save_post` get the right post format.

Props Chouby, SergeyBiryukov.
Fixes #41396.
Built from https://develop.svn.wordpress.org/trunk@41187


git-svn-id: http://core.svn.wordpress.org/trunk@41027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-30 14:41:42 +00:00
Drew Jaynes
5c075e5af7 Docs: Remove a few more superfluous @package WordPress and @subpackage notations outside of file headers missed in [40988].
See #41017.

Built from https://develop.svn.wordpress.org/trunk@40989


git-svn-id: http://core.svn.wordpress.org/trunk@40839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-01 17:11:41 +00:00
Drew Jaynes
bd2173f42c Docs: Remove an unnecessary @package tag from the DocBlock for post_preview().
See #41017.

Built from https://develop.svn.wordpress.org/trunk@40986


git-svn-id: http://core.svn.wordpress.org/trunk@40836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-01 16:39:41 +00:00
Drew Jaynes
ba40430e89 Docs: Add a valid return type for post_preview() and improve the DocBlock summary.
See #41017.

Built from https://develop.svn.wordpress.org/trunk@40985


git-svn-id: http://core.svn.wordpress.org/trunk@40835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-01 16:37:42 +00:00
Sergey Biryukov
9fb2e79b57 Posts, Post Types: In wp_check_post_lock(), check if the user with lock exists and return false otherwise.
Props arshidkv12, 1naveengiri.
Fixes #39888.
Built from https://develop.svn.wordpress.org/trunk@40424


git-svn-id: http://core.svn.wordpress.org/trunk@40322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-13 23:09:43 +00:00
Sergey Biryukov
bef3ff1377 Posts, Post Types: Improve the docs for wp_check_post_lock() and wp_set_post_lock().
See #39888.
Built from https://develop.svn.wordpress.org/trunk@40423


git-svn-id: http://core.svn.wordpress.org/trunk@40321 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-13 23:02:42 +00:00
Sergey Biryukov
93d4caaccd Docs: Add missing @param tag for show_post_locked_dialog filter.
Props keesiemeijer.
Fixes #39479.
Built from https://develop.svn.wordpress.org/trunk@39710


git-svn-id: http://core.svn.wordpress.org/trunk@39650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-06 21:59:04 +00:00
James Nylen
505e135f4c 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.

Props jblz, tyxla.
Fixes #39092.

Built from https://develop.svn.wordpress.org/trunk@39598


git-svn-id: http://core.svn.wordpress.org/trunk@39538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-13 14:09:42 +00:00
Dominik Schilling
3dc47839db Docs: Document the usage of the global $wpdb in _filter_query_attachment_filenames().
Props mt8.biz.
Fixes #38973.
Built from https://develop.svn.wordpress.org/trunk@39390


git-svn-id: http://core.svn.wordpress.org/trunk@39330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-30 23:20:42 +00:00
Sergey Biryukov
acc30b09d7 Text Changes: Merge some duplicate strings with the same meaning in error messages, adjust some other strings for consistency and accuracy.
Props ramiy, SergeyBiryukov.
Fixes #38808.
Built from https://develop.svn.wordpress.org/trunk@39278


git-svn-id: http://core.svn.wordpress.org/trunk@39218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-17 15:53:33 +00:00
John Blackbourn
babd79fb36 Posts, Post Types: Prevent users from being able to delete a protected meta field from a post.
Previously a user could remove a protected meta field by using their browser developer tools to alter the form field properties in the Custom Fields meta box, given that they know the ID of the protected meta field. This change prevents this by preventing any change to a protected meta field, including changing its key.

Props ajoah, johnbillion, peterwilsoncc
Fixes #38293

Built from https://develop.svn.wordpress.org/trunk@39062


git-svn-id: http://core.svn.wordpress.org/trunk@39004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-31 19:30:32 +00:00
Joe McGill
173f9b6f22 Media: Better handling of JOINs when searching filenames.
Following [38625], any media searches that already included JOINs,
e.g., `tax_queries`, would get trampled when we joined the post meta
table to search for filenames. This preserves existing JOINs and
also only applies the `_filter_query_attachment_filenames()` filter
when a search query is being performed.

Props flixos90, joemcgill.
Fixes #22744.
Built from https://develop.svn.wordpress.org/trunk@38733


git-svn-id: http://core.svn.wordpress.org/trunk@38676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-05 19:51:30 +00:00
Joe McGill
8f36a570cb Media: Make media library searchable by filename.
This applies a new private function, `_filter_query_attachment_filenames()`,
to the `post_clauses` filter hook during `wp_ajax_query_attachments()` and
`wp_edit_attachments_query_vars()` to include `_wp_attached_file` post meta
in search queries performed from the media library or in a `WP_Media_List_Table`.

Props wonderboymusic, DrewAPicture, joemcgill, swissspidy.
Fixes #22744.
Built from https://develop.svn.wordpress.org/trunk@38625


git-svn-id: http://core.svn.wordpress.org/trunk@38568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-20 01:45:31 +00:00
Aaron Jorbin
7e811d7120 Permalinks: Ensure Pending Review Posts permalink posts link to the draft
[34670] made the displayed permalink clickable. For posts that were pending review, the permalink wasn't being properly generated so the link wouldn't go to the preview.

Props knutsp, enshrined.
Fixes #37423.


Built from https://develop.svn.wordpress.org/trunk@38572


git-svn-id: http://core.svn.wordpress.org/trunk@38515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-08 04:05:31 +00:00
Scott Taylor
d31456b615 Media: add a function, wp_get_additional_image_sizes(), that wraps the retrieval of the global $_wp_additional_image_sizes. Removes 6 global imports.
See #37699.

Built from https://develop.svn.wordpress.org/trunk@38303


git-svn-id: http://core.svn.wordpress.org/trunk@38244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-22 04:37:28 +00:00
John Blackbourn
594b88661a Permalinks: Correct the documentation for the get_sample_permalink filter, and improve the documentation for the get_sample_permalink() function.
Props sebastian.pisula for the original patch
Fixes #37682

Built from https://develop.svn.wordpress.org/trunk@38272


git-svn-id: http://core.svn.wordpress.org/trunk@38213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-17 18:30:30 +00:00
Sergey Biryukov
a7a8585640 Posts, Post Types: Remove a redundant function_exists( 'mb_strlen' ) check in get_sample_permalink_html().
`mb_strlen()` is always available since [32114].

See #30633.
Built from https://develop.svn.wordpress.org/trunk@38147


git-svn-id: http://core.svn.wordpress.org/trunk@38088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-23 13:08:44 +00:00
Dominik Schilling
eb0ee24750 Post Thumbnails: Remove an unused nonce in _wp_post_thumbnail_html().
See #12922.


Built from https://develop.svn.wordpress.org/trunk@38137


git-svn-id: http://core.svn.wordpress.org/trunk@38078 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-22 11:44:28 +00:00
Dominik Schilling
c4dfc0adba Media: Remove global import for $content_width in _wp_post_thumbnail_html().
`$content_width` is unused since [35023].

See #28512.
Built from https://develop.svn.wordpress.org/trunk@38136


git-svn-id: http://core.svn.wordpress.org/trunk@38077 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-22 11:40:28 +00:00
Joe McGill
3dbba0fff3 Post Thumbnails: Only update featured images when saving a post.
Previously, changing the post thumbnail of a published post in the edit screen
would immediately apply the change, rather than waiting for the post to be
saved before applying the update. This could lead to someone unintentionally
editing the post thumbnail on a published post, and made it impossible to
preview changes to post thumbnails on published posts before saving the change.

This introduces a new Ajax handler, `wp_ajax_get_post_thumbnail_html()` to
retrieve the HTML for the post thumbnail meta box without updating the post
meta value for `_thumbnail_id`. It also allows post thumbnail changes to be
previewed by passing the `_thumbnail_id` as a query variable to the preview
screen and adding a new filter, `_wp_preview_post_thumbnail_filter()`, which
gets applied to `get_post_metadata` during the post preview process.

Props flixos90.
Fixes #12922.
Built from https://develop.svn.wordpress.org/trunk@38118


git-svn-id: http://core.svn.wordpress.org/trunk@38059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 16:24:28 +00:00
Drew Jaynes
31f150080a Docs: Standardize references to "meta box" or "meta boxes" as two distinct words throughout core documentation per the core spelling guide.
See #32246.

Built from https://develop.svn.wordpress.org/trunk@38029


git-svn-id: http://core.svn.wordpress.org/trunk@37970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-10 00:56:28 +00:00
Drew Jaynes
7eb6471461 Docs: Fix minor formatting and syntax for wp-admin/* elements introduced in 4.6.
See #37318.

Built from https://develop.svn.wordpress.org/trunk@38024


git-svn-id: http://core.svn.wordpress.org/trunk@37965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-09 14:00:31 +00:00
Dominik Schilling
25e66e4f1e Text Changes: Unify permission error messages.
The new format looks like "Sorry, you are not allowed to <action>.". This provides a consistent experience for all error messages related to missing permissions. It also reduces the number of similar strings and allows translators to provide a consistent style in their language.

Props ramiy, Presskopp.
Fixes #34521.
Built from https://develop.svn.wordpress.org/trunk@37914


git-svn-id: http://core.svn.wordpress.org/trunk@37855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-29 15:16:29 +00:00
Nikolay Bachiyski
c5d9d5cc18 Admin: escape URL-encoded permalinks
Built from https://develop.svn.wordpress.org/trunk@37801


git-svn-id: http://core.svn.wordpress.org/trunk@37766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-21 14:46:49 +00:00
Boone Gorges
6d05c7521b Taxonomy: More specific cap check when processing category data on post save.
Props dlh.
Fixes #36379.
Built from https://develop.svn.wordpress.org/trunk@37691


git-svn-id: http://core.svn.wordpress.org/trunk@37657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-14 01:37:29 +00:00
Drew Jaynes
c3055cc190 Docs: Standardize hook docs in wp-admin/* to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

Built from https://develop.svn.wordpress.org/trunk@37488


git-svn-id: http://core.svn.wordpress.org/trunk@37456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:01:30 +00:00
Boone Gorges
1e82651504 Pass thumbnail ID to the admin_post_thumbnail_html filter.
Also updates changelog to reflect that `$post->ID` was added in 3.5

Props johnjamesjacoby.
Fixes #36443.
Built from https://develop.svn.wordpress.org/trunk@37196


git-svn-id: http://core.svn.wordpress.org/trunk@37162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-13 16:18:28 +00:00
Aaron Jorbin
1972aa2a2a Add grunt prerelease task
An unintended consequence of improving the precommit task is that when it's time to run a release, more tasks need to get run to verify things. This adds a prerelease task to help fix that situation. grunt prerelease should include tasks that verify the code base is ready to be released to the wild and find all the tears on the mausoleum floor and help Blood stain the Colosseum doors.

See #35557

Built from https://develop.svn.wordpress.org/trunk@36930


git-svn-id: http://core.svn.wordpress.org/trunk@36898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-10 05:37:27 +00:00
John Blackbourn
3184328ecb Posts, Post Types: Ensure that non-ASCII characters in attachment slugs aren't shown in urlencoded form in the sample permalink UI.
Fixes #35980

Built from https://develop.svn.wordpress.org/trunk@36853


git-svn-id: http://core.svn.wordpress.org/trunk@36820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-05 03:56:27 +00:00
Sergey Biryukov
ab0eb71d21 Revisions: Clean up _wp_post_revision_fields():
* Move the array processing to a new function, `_wp_post_revision_data()`.
* Make both functions accept a post array or a `WP_Post` object. 
* Always apply the `_wp_post_revision_fields` filter and pass the post data to it.

Fixes #13382.
Built from https://develop.svn.wordpress.org/trunk@36659


git-svn-id: http://core.svn.wordpress.org/trunk@36626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 00:44:59 +00:00
Andrea Fercia
08510d2e5d Accessibility: after [36000] conditionally print out the aria-describedby attribute on the Featured Image postbox.
Fixes #35076.
Built from https://develop.svn.wordpress.org/trunk@36584


git-svn-id: http://core.svn.wordpress.org/trunk@36551 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-19 15:10:28 +00:00
Andrew Ozz
2413e41f8c Do not strip slashes from the whole &_POST when doing autosaves.
Props joehoyle.
Fixes #35408.
Built from https://develop.svn.wordpress.org/trunk@36543


git-svn-id: http://core.svn.wordpress.org/trunk@36510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-17 00:10:27 +00:00