Commit Graph

11034 Commits

Author SHA1 Message Date
Peter Wilson
56939ff70e Media: Ensure get_post_status() returns correct result for attachments.
Prevent `get_post_status()` returning `false` for attachments if the parent post has been deleted. The returned attachment post status is now passed through the `get_post_status` filter.

Add tests for `get_post_status()`.

Props peterwilsoncc, timothyblynjacobs for review.
Fixes #52326.



git-svn-id: https://develop.svn.wordpress.org/trunk@49985 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-20 04:39:24 +00:00
Greg Ziółkowski
f84ebe3fe7 Blocks: Add automatic RTL handlind for block styles registered from metadata
Related Gutenberg issue: https://github.com/WordPress/gutenberg/pull/28274

With this change it is going to be possible to use the same pattern that wp_style_add_data uses for RTL handling. If the block style file with "-rtl.css" is included in addition to the regular style referenced in "block.json" file then it is going to be automatically registered.

Props swisspidy, aristath.
See #52301.



git-svn-id: https://develop.svn.wordpress.org/trunk@49982 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-19 11:48:59 +00:00
Greg Ziółkowski
edd77c0791 Blocks: Add i18n support to register_block_type_from_metadata
Related Gutenberg issue: https://github.com/WordPress/gutenberg/issues/23636.
Related WP-CLI PR: https://github.com/wp-cli/i18n-command/pull/210.
Related documentation proposal: https://github.com/WordPress/gutenberg/blob/master/docs/designers-developers/developers/block-api/block-metadata.md#internationalization-not-implemented

Adds programatic i18n support to `register_block_type_from_metadata` function for block settings registered from `block.json` file that provides `textdomain` field.


Props swissspidy, ocean90.
Fixes #52301.



git-svn-id: https://develop.svn.wordpress.org/trunk@49981 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-19 11:04:03 +00:00
Sergey Biryukov
b6830fabc4 Media: Use consistent method for instantiating an attachment author object in Media Library.
Previously, attachments without an author could cause a PHP fatal error due to calling the `::exists()` method on a `false` value.

Props antpb, carloscastilloadhoc, hellofromTonya, garrett-eclipse.
Fixes #52030.

git-svn-id: https://develop.svn.wordpress.org/trunk@49979 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-18 12:53:30 +00:00
Sergey Biryukov
cfa490b16b Docs: Link to the parent function for accepted arguments in some filters for HTML output.
See #51800.

git-svn-id: https://develop.svn.wordpress.org/trunk@49977 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-18 12:26:50 +00:00
Sergey Biryukov
ca5538dda3 Posts, Post Types: Introduce a filter paginate_links() output.
Props sabernhardt, audrasjb, re.ardestani.
Fixes #44018.

git-svn-id: https://develop.svn.wordpress.org/trunk@49976 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-18 12:05:06 +00:00
Sergey Biryukov
fdd9fa6107 Privacy: Use more consistent wording for strings related to personal data requests.
This replaces "user privacy" in various error messages with "personal data", for consistency with other existing strings.

Follow-up to [49090].

Props xkon, transl8or.
Fixes #51849.

git-svn-id: https://develop.svn.wordpress.org/trunk@49970 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-17 17:45:01 +00:00
Sergey Biryukov
698f341e1c Docs: Correct description for wp_slash() and wp_unslash().
The array received or returned by these functions is not always an array of strings, for example when slashing or unslashing an array of arrays.

Follow-up to [47400], [48441], [49926].

Props johnbillion.
See #51800.

git-svn-id: https://develop.svn.wordpress.org/trunk@49968 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-17 16:36:14 +00:00
Dominik Schilling
d1ac4cd40a I18N: Add support for German (Austria) locale in remove_accents().
Props patopaiar, nonverbla.
Fixes #52110.

git-svn-id: https://develop.svn.wordpress.org/trunk@49967 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-17 15:44:04 +00:00
Timothy Jacobs
244e4d4e63 REST API: Allow sending an empty array to delete multi meta keys.
Previously, only `null` was supported.

Fixes #50790.
Props chrisvanpatten.


git-svn-id: https://develop.svn.wordpress.org/trunk@49966 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-17 00:49:39 +00:00
Sergey Biryukov
994e657e74 Coding Standards: Fix WPCS issue in [49963].
Props pawki07, mukesh27.
Fixes #52316. See #51800.

git-svn-id: https://develop.svn.wordpress.org/trunk@49965 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-16 17:19:00 +00:00
Sergey Biryukov
fbab01c8ce Docs: In various @return tags, list the expected type first, instead of false.
Follow-up to [46696], [47060], [49926], [49927], [49929].

See #51800.

git-svn-id: https://develop.svn.wordpress.org/trunk@49963 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-15 20:06:50 +00:00
Peter Wilson
495e236505 Build/Test Tools: Update script loader following [49933].
See #51801.


git-svn-id: https://develop.svn.wordpress.org/trunk@49959 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-14 02:22:26 +00:00
John Blackbourn
6aca60d33a REST API: Corrections and improvements to docblocks for REST API filters.
See #51800


git-svn-id: https://develop.svn.wordpress.org/trunk@49955 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-10 22:21:39 +00:00
Timothy Jacobs
1f2695ed1f REST API: Fix fatal error on multisite when calling the single item plugin routes.
The `is_network_only_plugin` and `is_plugin_active` functions are not available in a front-end context and must be specifically loaded.

Props oakesjosh.
Fixes #52205.


git-svn-id: https://develop.svn.wordpress.org/trunk@49952 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-09 20:20:44 +00:00
Sergey Biryukov
fdfe183017 Accessibility: Customize: Add an empty alt attribute to the <img> tag used as a hidden placeholder in the Customizer preview when no logo is chosen.
Per accessibility best practices, it is recommended that all HTML `<img>` elements have an `alt` attribute. Any decorative images should have an empty `alt` attribute (`alt=""`).

Props laxman-prajapati, sabernhardt, audrasjb.
Fixes #51846.

git-svn-id: https://develop.svn.wordpress.org/trunk@49949 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-08 16:53:50 +00:00
Greg Ziółkowski
bb01f0187c Editor: Support filtering arguments in block type registration from metadata
Adds 2 new hooks in `register_block_type_from_metadata`:

- Named `block_type_metadata` to filter the content of metadata read from `block.json`
- Named `block_type_metadata_settings` to filter the settings object determined from the metadata that is passed to `register_block_type` call

Props swissspidy.
Fixes #52138.



git-svn-id: https://develop.svn.wordpress.org/trunk@49948 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-08 16:43:29 +00:00
John Blackbourn
cf68c90021 Taxonomy: Correct and clarify documentation for the return types of term query functions.
See #51800, #38266


git-svn-id: https://develop.svn.wordpress.org/trunk@49947 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-08 15:22:17 +00:00
John Blackbourn
31476dc27c Plugins: Replace usage of $this in action and filter parameter docblocks with more appropriate variable names.
See #51800, #52217

Fixes #52243


git-svn-id: https://develop.svn.wordpress.org/trunk@49946 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-08 14:28:46 +00:00
John Blackbourn
de330964b1 Docs: Miscellaneous docblock corrections and improvements.
See #51800.

git-svn-id: https://develop.svn.wordpress.org/trunk@49942 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-07 14:15:27 +00:00
Sergey Biryukov
7c0d1208fb Docs: Correct description for wp_parse_list().
The function simply converts a comma- or space-separated list of scalar values to an array and does not perform any sanitization on its own.

Follow-up to [44546].

Props johnjamesjacoby.
See #51800.

git-svn-id: https://develop.svn.wordpress.org/trunk@49941 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-06 17:23:53 +00:00
John Blackbourn
8153c8ba02 Docs: Corrections and improvements to types used in various docblocks.
See #51800, #52217


git-svn-id: https://develop.svn.wordpress.org/trunk@49936 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-05 17:14:24 +00:00
Sergey Biryukov
5c82078df7 Docs: Use more consistent descriptions for void|false return values.
See #51800.

git-svn-id: https://develop.svn.wordpress.org/trunk@49935 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-05 16:46:02 +00:00
Sergey Biryukov
019a261d3f Docs: Fix typo in wp_set_comment_status filter DocBlock.
Follow-up to [49926].

See #51800.

git-svn-id: https://develop.svn.wordpress.org/trunk@49934 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-05 16:44:24 +00:00
Sergey Biryukov
715daf875a Docs: In various @return tags, list the expected type first, instead of false or WP_Error.
Follow-up to [46696], [47060], [49926], [49927].

See #51800.

git-svn-id: https://develop.svn.wordpress.org/trunk@49929 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-04 17:16:43 +00:00
Sergey Biryukov
7bd678a553 Docs: Synchronize and correct documentation for has_filter() and WP_Hook::has_filter().
`WP_Hook::has_filter()` returns true if `$function_to_check` is omitted and the hook being checked has one or more registered callbacks.

Follow-up to [49927].

See #51800.

git-svn-id: https://develop.svn.wordpress.org/trunk@49928 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-04 16:56:20 +00:00
John Blackbourn
679ccc35e6 Docs: Promote many bool types to true or false where only that value is used.
See #51800


git-svn-id: https://develop.svn.wordpress.org/trunk@49927 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-03 22:02:13 +00:00
John Blackbourn
374b41ed13 Docs: Various docblock corrections particularly relating to boolean types.
See #51800


git-svn-id: https://develop.svn.wordpress.org/trunk@49926 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-03 21:55:04 +00:00
Timothy Jacobs
69cc6e61d0 REST API: Expose all themes in the themes controller.
Previously, only the active theme was made available. This commit allows for all themes to be queried if the user has the `switch_themes` or `manage_network_themes` capabilities.

This commit also no longer exposes the `page`, `per_page`, `search` and `context` query parameters since they are not supported by this controller.

Props spacedmonkey, lpawlik, TimothyBlynJacobs.
Fixes #50152.


git-svn-id: https://develop.svn.wordpress.org/trunk@49925 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-03 21:45:42 +00:00
Sergey Biryukov
087ff2f8ef Canonical: Check if the post type exists when attempting a canonical redirect.
This avoids a PHP notice if the post type is no longer registered.

Follow-up to [14595], [35480].

Props bobbingwide, hareesh-pillai.
Fixes #40309.

git-svn-id: https://develop.svn.wordpress.org/trunk@49924 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-03 17:54:48 +00:00
Timothy Jacobs
a6a021d037 REST API: Move the WP_Query args filter after the tax_query is setup.
This ensures that the entire list of `WP_Query` args are filterable in the posts controller.

Props Krstarica, TimothyBlynJacobs.
Fixes #42762.


git-svn-id: https://develop.svn.wordpress.org/trunk@49923 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-03 02:37:23 +00:00
Timothy Jacobs
ab388522aa REST API: Only include the controller's own taxonomy in it's schema.
Previously, all taxonomies were incorrectly exposed as possible values.

Props johnbillion.
Fixes #51940.


git-svn-id: https://develop.svn.wordpress.org/trunk@49922 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-02 23:47:42 +00:00
Timothy Jacobs
902e3f6b85 App Passwords: Only attempt auth if the username and password are set.
Previously, only the username was checked which caused a PHP warning in some server setups, for instance Shibboleth SSO, where the server only populates the `PHP_AUTH_USER` field.

Props MadtownLems, johnbillion, richard.tape, engahmeds3ed.
Fixes #52003.


git-svn-id: https://develop.svn.wordpress.org/trunk@49919 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-02 21:34:01 +00:00
Timothy Jacobs
2206495007 REST API: Properly display JSON encoding errors.
Previously `null` was returned because the server was accessing the incorrect variable.

Props atimmer, technosailor.
Fixes #52106.


git-svn-id: https://develop.svn.wordpress.org/trunk@49918 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-02 20:35:01 +00:00
Sergey Biryukov
c32b13d2e7 Docs: Second pass at replacing Codex URLs with a corresponding HelpHub or DevHub article.
Follow-up to [45674-45677].

Props marcio-zebedeu, zodiac1978, netweb.
See #48987.

git-svn-id: https://develop.svn.wordpress.org/trunk@49912 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-29 20:12:42 +00:00
Gary Pendergast
f6042ffc5b Site Health: Check that WordPress is installed before scheduling the HTTPS cron.
Trying to schedule cron jobs before WordPress is installed results in DB errors, which is suboptimal.

See #47577.



git-svn-id: https://develop.svn.wordpress.org/trunk@49909 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-28 01:43:18 +00:00
Sergey Biryukov
b16def4d1d Accessibility: Upgrade/Install: Add more contrast to input borders during installation.
This brings the accessibility improvements previously made for other areas of the admin in WordPress 5.3 to the installation screens too.

Follow-up to [46241-46244], [46247], [46248], [46293], [46425].

Props Maigret, audrasjb.
Fixes #51854.

git-svn-id: https://develop.svn.wordpress.org/trunk@49907 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-26 19:52:48 +00:00
Sergey Biryukov
0f33f289e8 Docs: Correct the type of the $user parameter in WP_REST_Users_Controller::prepare_links().
Props iviweb, mukesh27.
Fixes #52175.

git-svn-id: https://develop.svn.wordpress.org/trunk@49906 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-25 14:52:25 +00:00
Sergey Biryukov
54b6981355 Posts, Post Types: Correct the check for term IDs to be queued for lazy-loading term meta.
This ensures that the `$term_ids` array in `wp_queue_posts_for_term_meta_lazyload()` (an indexed array not keyed by ID) does not contain duplicate values.

Props denishua, akabarikalpesh.
Fixes #52144.

git-svn-id: https://develop.svn.wordpress.org/trunk@49905 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-24 11:19:29 +00:00
Felix Arntz
e78d988aa2 Security, Site Health: Detect HTTPS support and encourage switching.
This changeset modifies the Site Health panel for HTTPS to provide more accurate recommendations based on whether the environment is already set up for HTTPS.

* Introduces `wp_is_using_https()` to check whether the site is configured to use HTTPS (via its Site Address and WordPress Address).
* Introduces `wp_is_https_supported()` to check whether the environment supports HTTPS. This relies on a cron job which periodically checks support using a loopback request.

Props Clorith, flixos90, miinasikk, westonruter.
Fixes #47577.


git-svn-id: https://develop.svn.wordpress.org/trunk@49904 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-23 19:11:20 +00:00
Peter Wilson
254131d009 Query: Revert post-type specific capability changes.
The modified checks of the `read_private_posts` capability could result in unexpected SQL queries when calling `WP_Query` with invalid parameters.

Reverts [49830], [49832] and [49833].
See #48556.


git-svn-id: https://develop.svn.wordpress.org/trunk@49899 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-23 03:01:00 +00:00
John Blackbourn
7ef5a65f44 XML-RPC: Emit an appropriate HTTP status code when an error is returned in response to an XML-RPC request.
This most notably affects the response when XML-RPC is disabled or when the supplied username and password is incorrect.

Props ericmann

Fixes #48213


git-svn-id: https://develop.svn.wordpress.org/trunk@49862 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-21 20:21:12 +00:00
Sergey Biryukov
9027e7c489 Docs: Move locale filter documentation to the canonical place.
See #51800.

git-svn-id: https://develop.svn.wordpress.org/trunk@49859 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-21 18:24:53 +00:00
Sergey Biryukov
af5bab23ab Docs: Move sanitize_file_name filter documentation to the canonical place.
See #51800.

git-svn-id: https://develop.svn.wordpress.org/trunk@49858 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-21 18:23:21 +00:00
John Blackbourn
51f9a54c9d XML-RPC: Fix a type error when requesting the menu field of a taxonomy.
Fixes #51493


git-svn-id: https://develop.svn.wordpress.org/trunk@49856 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-21 17:09:50 +00:00
Greg Ziółkowski
3d43e57237 Blocks: Align with Gutenberg the name of generated asset handle for core blocks
Related Gutenberg PR: https://github.com/WordPress/gutenberg/pull/25220.

It aligns with the latest changes added by aristath to the Gutenberg project. As part of styles splitting for core blocks, there was a special pattern introduced for how style handles are named. Ideally, we would apply it to all blocks but there might be some backward compatibility considerations so I left the handling for non-core blocks unchanged.

Props aristath.
See #50328.



git-svn-id: https://develop.svn.wordpress.org/trunk@49850 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-21 11:37:30 +00:00
John Blackbourn
00dd0ba3b0 Upload: Introduce the {$action}_overrides filter that allows the overrides parameter for file uploads and file sideloads to be filtered.
The dynamic portion of the hook name, `$action`, refers to the post action.

Props iandunn, jakub.tyrcha, nacin, wonderboymusic, Mte90, johnbillion

Fixes #16849


git-svn-id: https://develop.svn.wordpress.org/trunk@49845 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-20 16:13:23 +00:00
John Blackbourn
99cfb00d13 Mail: Introduce a pre_wp_mail filter to allow short-circuiting the wp_mail() function without having to override the pluggable function.
Props DvanKooten, swissspidy, SergeyBiryukov, jtsternberg, ericlewis, Mte90, birgire, ayeshrajans

Fixes #35069


git-svn-id: https://develop.svn.wordpress.org/trunk@49844 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-20 15:07:23 +00:00
John Blackbourn
b04671e52f Query: Ensure the author archive title always shows the name of the queried author, regardless of whether there are results.
This brings the behaviour inline with the `<title>` element of the page which always shows the author name.

Props Tkama, subrataemfluence

Fixes #44183


git-svn-id: https://develop.svn.wordpress.org/trunk@49843 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-20 14:35:58 +00:00
Peter Wilson
1930427d30 Coding Standards: Minor fixes following [49830].
See #13509, #48968, #48556.


git-svn-id: https://develop.svn.wordpress.org/trunk@49832 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-18 00:17:32 +00:00