Commit Graph

8444 Commits

Author SHA1 Message Date
audrasjb
e7d91b8017 General: Add required fields helper functions for better reusability.
This changeset introduces new `wp_required_field_indicator()` and `wp_required_field_message()` helper functions to generate reusable and consistent required field indicator and message. It also implements these functions in various admin screens.

Props sabernhardt, ryokuhi, joedolson, audrasjb, SergeyBiryukov.
Fixes #54394.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-12 12:11:09 +00:00
Peter Wilson
0161ef8f72 Media: Cache parent posts in query-attachments AJAX endpoint.
Prime the parent post objects `wp_ajax_query_attachments()` to reduce the number of database queries in the query-attachments admin-ajax endpoint.

Props albatross10.
Fixes #56037.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-12 00:17:07 +00:00
John Blackbourn
1d4e72c798 Docs: Correct and improve the documented types for various functions and hooks.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 14:03:09 +00:00
John Blackbourn
bbdc255d50 Docs: Remove code tags from WordPress function names within inline documentation.
Removing these code tags means the function name will be automatically linked on the developer.wordpress.org reference, which is more useful than just seeing the function name.

See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53435 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 13:55:08 +00:00
Sergey Biryukov
c3783c9f3a Coding Standards: Rename the $file parameter to $path in some WP_Filesystem_* methods.
This aims to bring more clarity to the code, and applies to methods where the path can be a file or a directory:

* `WP_Filesystem_*::exists()`
* `WP_Filesystem_*::is_writable()`

Follow-up to [6779], [25560].

See #55647.
Built from https://develop.svn.wordpress.org/trunk@53872


git-svn-id: http://core.svn.wordpress.org/trunk@53431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-09 11:33:10 +00:00
Peter Wilson
f627535216 Administration: Improve performance of List Tables.
Improve the performance of `WP_List_Table::get_column_info()` by adding the primary column to the cached header values. This reduces the number of calls to the `WP_List_Table::get_primary_column_name()` method to once per table in line with the other header getter functions.

Props bobbingwide, chaion07, costdev, mikeschroder, mukesh27, peterwilsoncc, shetheliving, spacedmonkey.
Fixes #34564.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-09 00:33:11 +00:00
Sergey Biryukov
7f0fc452b1 Docs: Improve @since notes for some WP_Filesystem_* methods:
* `WP_Filesystem_FTPext::exists()`
* `WP_Filesystem_FTPext::size()`
* `WP_Filesystem_ftpsockets::exists()`

The `::exists()` methods were previously using the FTP `NLST` command, which works for directories, but is not intended to be applied to a file. This only worked most of the time due to many FTP servers being permissive and allowing to execute `NLST` on files, which cannot be guaranteed and appears to not be the case in newer versions of Pure-FTPd (1.0.48 or later).

With a recent change in [53860], both methods were updated for compatibility with RFC 959:

* Both methods check if the path is a directory that can be changed into (and therefore exists).
* `WP_Filesystem_FTPext` uses `ftp_rawlist()` (FTP `LIST` command) to check for file existence.
* `WP_Filesystem_ftpsockets` uses file size to check for file existence.

Reference: [https://www.ietf.org/rfc/rfc959.txt RFC 959: File Transfer Protocol (FTP)]

Follow-up to [6779], [11821], [25274], [33648], [34733], [35944], [35946], [53860].

See #51170.
Built from https://develop.svn.wordpress.org/trunk@53862


git-svn-id: http://core.svn.wordpress.org/trunk@53421 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-08 17:14:13 +00:00
audrasjb
6a5506304e Filesystem: Rewrite FTP/FTP Sockets exists() methods to implement a more stable check.
WordPress FTP file checking was previously based upon `ftp_nlist()`. This function can be problematic at scale with a directory containing a large number of files. The same issue occurred using it with ftpsockets.

This changeset rewrites the FTP `exists()` functions to utilize a more efficient and stable check.

Props giox069, desrosj, mkox, afragen, costdev, pbiron, peterwilsoncc.
Fixes #51170.
See #53318, #39781.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-08 12:41:13 +00:00
Adam Silverstein
66372143a1 Media: use original image size data for full size secondary mime generation.
Correct an issue where the secondary mime type full size image would not be properly resized (and `-scaled` added to the name) when the original upload is over the `big_image_size_threshold` dimensions.

Props mukesh27.
See #55443.



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


git-svn-id: http://core.svn.wordpress.org/trunk@53407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 22:16:13 +00:00
Adam Silverstein
4b0450af4f Media: correct a misnamed variable when creating sub sizes with multi_resize.
Props mehulkaklotar, mukesh27.
See #55443.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53406 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 18:58:12 +00:00
Adam Silverstein
c1862616c2 Media: remove unused _wp_image_belongs_to_attachment function.
Remove the `_wp_image_belongs_to_attachment` function which was left over from a an unused branch and added inadvertently as part of r53751.

Props mukesh27.
Fixes #56333.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53404 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 16:12:13 +00:00
audrasjb
6996204bab Docs: Various docblock fixes in wp-admin/includes/image.php class, as per docs standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 14:07:09 +00:00
Sergey Biryukov
5e6acb229d Revisions: Use wp_get_latest_revision_id_and_total_count() where appropriate.
The function executes an optimized query to get the last revision ID and total count. It was originally introduced for `WP_REST_Posts_Controller::prepare_links()`, and is now used in a few more places in core:

* `register_and_do_post_meta_boxes()`
* `wp_get_post_revisions_url()`
* `wp_update_custom_css_post()`

Follow-up to [53759], [53769], [53778], [53779], [53841].

Props peterwilsoncc, mukesh27, SergeyBiryukov.
Fixes #56279.
Built from https://develop.svn.wordpress.org/trunk@53842


git-svn-id: http://core.svn.wordpress.org/trunk@53401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 13:39:11 +00:00
audrasjb
233089c138 Coding standards: Properly escape URLs returned by self_admin_url() calls.
This address some other echoed instances missed by [53839].

Fixes #56329.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53399 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 06:12:10 +00:00
audrasjb
b79e2df684 Coding standards: Properly escape URLs returned by self_admin_url() calls.
Props krishaweb, audrasjb, SergeyBiryukov.
Fixes #56329.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 06:00:09 +00:00
Sergey Biryukov
de97f21367 Coding Standards: Remove extra space in two conditionals.
This fixes WPCS errors in `WP_Site_Health::get_test_plugin_version()` and `::get_test_theme_version()`:

* `Expected exactly one space between closing parenthesis and opening control structure; " " found.`
* `Expected 1 space(s) after closing parenthesis; found 2`

Follow-up to [53816].

See #56134.
Built from https://develop.svn.wordpress.org/trunk@53817


git-svn-id: http://core.svn.wordpress.org/trunk@53376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-03 14:32:12 +00:00
Sergey Biryukov
1f39318123 Site Health: Improve the wording in plugin and theme version tests.
This displays a more appropriate message in case the site does not have any active plugins or installed themes.

Follow-up to [44986], [45099], [45336].

Props Presskopp, costdev, martin.krcho, Clorith, SergeyBiryukov.
Fixes #56134.
Built from https://develop.svn.wordpress.org/trunk@53816


git-svn-id: http://core.svn.wordpress.org/trunk@53375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-03 13:09:09 +00:00
audrasjb
66d425d86a Administration: Change default site tagline to an empty string.
This changeset replaces the default "Just another WordPress site" tagline with an empty string for new installations. The reasoning is:

1. Not all themes display the tagline;
2. Not everyone changes the default tagline;
3. When people don't see the tagline in their theme, they may not realize it is still visible in some places, like feeds.

The string "Just another WordPress site" and the related multisite string: "Just another {NETWORK} site" are now only used as a placeholder for the tagline admin option.

Props markjaquith, Denis-de-Bernardy, westi, RyanMurphy, kovshenin, SergeyBiryukov, chriscct7, tyxla, hyperbrand, karmatosed, lukecavanagh, melchoyce, boemedia, khag7, sabernhardt, audrasjb, peterwilsoncc, costdev, martinkrcho, rafiahmedd.
Fixes #6479.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-03 12:20:16 +00:00
Sergey Biryukov
f53c815b6e Coding Standards: Use more meaningful variables names in some Ajax functions.
This renames `$tax` to `$taxonomy_object` and `$s` to `$search` for clarity. The latter is only renamed when used as an internal variable and not referring to the `$s` global.

The list of affected functions:
* `wp_ajax_ajax_tag_search()`
* `wp_ajax_add_link_category`
* `wp_ajax_add_tag()`
* `wp_ajax_get_tagcloud()`
* `wp_ajax_inline_save_tax()`
* `wp_ajax_find_posts()`

Follow-up to [6542], [8901], [10222], [12833], [16771], [16992], [22723], [38698].

Props azouamauriac.
Fixes #55098.
Built from https://develop.svn.wordpress.org/trunk@53801


git-svn-id: http://core.svn.wordpress.org/trunk@53360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-30 15:16:08 +00:00
audrasjb
9a517ac7ae Docs: Various docblock improvements in Importer Administration API, as per docs standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-29 09:22:10 +00:00
audrasjb
d853d1ece2 Docs: Various docblock improvements in Export Administration API, as per docs standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-29 08:14:12 +00:00
audrasjb
49ace608dc Taxonomy: Allow filtering Ajax term search results in quick edit.
This changeset introduces the `ajax_term_search_results` hook which can be used to filter the term search results returned by the AJAX term query.

Props grandeljay, costdev, ironprogrammer, audrasjb, SergeyBiryukov.
Fixes #55606.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-26 13:23:14 +00:00
Sergey Biryukov
87464289c3 Revisions: Update the "last revision" wording to "latest revision" in various files.
This aims to reduce ambiguity about what exactly is the "first" or "last" revision, and bring more consistency with similar wording elsewhere in core, e.g. latest posts, latest comments, etc.

This affects:
* `wp_save_post_revision()`
* `wp_prepare_revisions_for_js()`
* `WP_Customize_Manager::filter_revision_post_has_changed()`

Follow-up to [53759], [53769], [53778].

Props peterwilsoncc.
Fixes #55857.
Built from https://develop.svn.wordpress.org/trunk@53779


git-svn-id: http://core.svn.wordpress.org/trunk@53338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-25 19:30:09 +00:00
audrasjb
a85bde79df Media: Prevent URLs from overflowing their container in the media editor.
This changeset also introduces the `.word-wrap-break-word` class which can be used to apply `word-wrap: break-word` to admin elements when needed.

Props mitogh, costdev, kapilpaul, alamgircsebd, sabernhardt, anantajitjg, afercia, circlecube, SergeyBiryukov, rafiahmedd, audrasjb.
Fixes #55393.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-25 18:11:08 +00:00
Sergey Biryukov
729ab2c971 Docs: Document that the $file_format parameter of metadata filters can be null.
This affects the `wp_read_video_metadata` and `wp_read_audio_metadata` filters.

Follow-up to [41746], [53764].

See #55646, #55828.
Built from https://develop.svn.wordpress.org/trunk@53768


git-svn-id: http://core.svn.wordpress.org/trunk@53327 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-23 15:06:10 +00:00
audrasjb
85e2d1df55 Docs: Add function description and @since mention for get_upload_iframe_src().
Follow-up to [14015].

See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-23 09:00:11 +00:00
audrasjb
007726602e Docs: Fix indentation issues in wp_read_video_metadata and wp_read_audio_metadata docblocks.
Follow-up to [53764].

See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-23 08:19:11 +00:00
audrasjb
32cc05a7c0 Media: Allow filtering audio file metadata in wp_read_audio_metadata().
This changeset introduces the `wp_read_audio_metadata` hook which allows to filter metadata extracted from an uploaded audio file.

This brings consistency with corresponding filters available for image and video file types:

- `wp_read_image_metadata` added in [6313] / #5162.
- `wp_read_video_metadata` added in [41746] / #35218.

Props luigipulcini, SergeyBiryukov, mukesh27.
Fixes #55828.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-23 08:13:11 +00:00
Adam Silverstein
71ca314193 Media: enable generating multiple mime types for image uploads; specifically WebP versions for JPEG images by default.
This changeset adds the capability for core media uploads to generate sub sized images in more than a single mime type. The output formats for each mime type can be controlled through a filter. WebP is used as an additional output format for JPEG images by default to improve front end performance.

When generating additional mime types, only images which are smaller than the respective original are retained. By default, additional mime type images are only generated for the built-in core image sizes and any custom sizes that have opted in.

Image meta is updated with a new 'sources' array containing file details for each mime type. Each image size in the 'sizes' array also gets a new 'sources' array that contains the image file details for each mime type.

This change also increases image upload retries to accommodate additional image sizes. It also adds a `$mime_type` parameter to the `wp_get_missing_image_subsizes` function and filter.

This change adds three new filters to enable full control of secondary mime image generation and output:

* A new filter `wp_image_sizes_with_additional_mime_type_support` that filters the sizes that support secondary mime type output. Developers can use this to control the output of additional mime type sub-sized images on a per size basis.
* A new filter `wp_upload_image_mime_transforms` that filters the output mime types for a given input mime type. Developers can use this to control generation of additional mime types for a given input mime type or even override the original mime type.
* A new filter `wp_content_image_mimes` which controls image mime type output selection and order for frontend content. Developers can use this to control the mime type output preference order for content images. Content images inserted from the media library will use the available image versions based on the order from this filter.

Thanks to the many contributors who helped develop, test and give feedback on this feature.

A haiku to summarize:

Upload a JPEG
Images of all sizes
Output as WebPs

Props flixos90, MatthiasReinholz, studiolxv, markhowellsmead, eatingrules, pbiron, mukesh27, joegrainger, mehulkaklotar, tweetythierry, akshitsethi, peterwilsoncc, eugenemanuilov, mitogh, shetheliving, clarkeemily, codekraft, mikeschroder, clorith, kasparsd, spacedmonkey, trevorpfromsandee, jb510, scofennellgmailcom, seedsca, cagsmith, karinclimber, dainemawer, baxbridge, grapplerulrich, sobatkras, chynnabenton, tonylocalword, barneydavey, kwillmorth, garymatthews919, olliejones, imarkinteractive, jeffpaul, feastdesignco, webbeetle, masteradhoc.

See #55443.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 18:03:13 +00:00
Sergey Biryukov
ee4f7d7415 Coding Standards: Adjust the logic slightly in wp_ajax_replyto_comment().
This aims to bring more consistency to the function logic by separating the comment content and type checks from the user existence check.

Follow-up to [8720], [9098], [29758].

See #55647.
Built from https://develop.svn.wordpress.org/trunk@53747


git-svn-id: http://core.svn.wordpress.org/trunk@53306 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 10:59:10 +00:00
audrasjb
49dd15fb6b Docs: Add missing function description in wp-admin/includes/template.php.
This changeset also includes a few docblock standards fixes in the same file.

See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 09:24:10 +00:00
audrasjb
70f9851fda Administration: Add labels to read-only form fields.
This changeset improves admin forms accessibility by adding labels to the following read-only form fields:

- Network setup screen: new visible label to the four textareas for code users need to paste into their wp-config file and the server configuration file (web.config or .htaccess).
- `setup-config.php`: new visible label to one textarea for code to include in the `wp-config` file manually.
- Admin toolbar: adds an `arial-label` attribute to the old "shortlink" feature (not used anymore but still activable by plugins).

Props sabernhardt, audrasjb, ryokuhi, joedolson.
Fixes #54302.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-21 09:04:14 +00:00
audrasjb
4770e926ab Docs: Use third-person singular verbs for function descriptions in wp-admin/includes/comment.php, as per docblocks standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 22:15:10 +00:00
audrasjb
0df025d2bd Docs: Add missing function description in wp-admin/includes/comment.php.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53301 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 22:12:09 +00:00
Sergey Biryukov
e2a5b8684e Coding Standards: Standardize on user_id when passing data to comment functions.
The `wp_new_comment()`, `wp_update_comment()`, and `wp_filter_comment()` functions already normalize the `user_ID` parameter internally to `user_id`, which matches the database field name.

This commit aims to bring some consistency when passing the parameter in core.

The corresponding `$user_ID` variable is also renamed to `$user_id` to match the other variables when not referring to the `$user_ID` global, which has an exception in the WordPress coding standards.

Follow-up to [8543], [8720], [12267], [12300], [26491], [28915], [28922], [34799], [49303].

See #55647, #56244.
Built from https://develop.svn.wordpress.org/trunk@53729


git-svn-id: http://core.svn.wordpress.org/trunk@53288 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 14:14:09 +00:00
Sergey Biryukov
69a8ecce33 Coding Standards: Rename $comment_post_ID and $comment_author_IP variables in various files.
This fixes two WPCS warnings:
* `Variable "$comment_post_ID" is not in valid snake_case format`
* `Variable "$comment_author_IP" is not in valid snake_case format`

While matching the database fields of the same name, these variables did not follow the WordPress coding standards, and are now renamed to address that.

Note: The name change only affects internal variables and parameters for a few actions receiving a comment post ID:

* `edit_comment`
* `comment_id_not_found`
* `comment_closed`
* `comment_on_trash`
* `comment_on_draft`
* `comment_on_password_protected`
* `pre_comment_on_post`

The change does not affect parameters for functions receiving an array of comment data:

* `wp_insert_comment()`
* `wp_new_comment()`
* `wp_update_comment()`
* `wp_handle_comment_submission()`

The associated array keys still match the database fields: `comment_post_ID` and `comment_author_IP`.

Follow-up to [1706], [2894], [8720], [28427], [28437], [28457], [34799], [53720],

See #55647, #56244.
Built from https://develop.svn.wordpress.org/trunk@53723


git-svn-id: http://core.svn.wordpress.org/trunk@53282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-19 16:19:11 +00:00
Sergey Biryukov
1069ac4afd Posts, Post Types: Standardize on $post parameter name where appropriate.
This renames the `$post_id` or `$id` parameters to `$post` for functions that accept a post ID or post object:

* `get_sample_permalink()`
* `get_sample_permalink_html()`
* `wp_check_post_lock()`
* `wp_set_post_lock()`
* `get_the_tags()`
* `comment_class()`
* `get_comment_class()`
* `get_comments_link()`
* `get_comments_number()`
* `comments_number()`
* `get_comments_number_text()`
* `comments_open()`
* `pings_open()`
* `comment_form()`
* `do_trackbacks()`
* `pingback()`
* `post_permalink()`
* `get_post_permalink()`
* `get_edit_post_link()`
* `edit_post_link()`
* `get_delete_post_link()`
* `post_class()`
* `get_post_class()`
* `the_attachment_link()`
* `wp_get_attachment_link()`
* `wp_list_post_revisions()`
* `check_and_publish_future_post()`
* `add_ping()`
* `get_pung()`
* `get_to_ping()`
* `wp_get_post_revisions()`
* `wp_get_post_revisions_url()`

Additionally, `$revision_id` is renamed to `$revision` in:

* `wp_restore_post_revision()`
* `wp_delete_post_revision()`

Includes minor documentation improvements for consistency and code layout fixes for better readability.

Follow-up to [1599], [1794], [2881], [3303], [3851], [5302], [6633], [6716], [6985], [7103], [7149], [7747], [8011], [8638], [8643], [8695], [9138], [9273], [11425], [11922], [11956], [12284], [12810], [12923], [13023], [13171], [25567], [27156], [27473], [28558], [28602], [33659], [38852], [47276], [47366], [48622], [49544], [49597], [52095].

See #56243, #55647.
Built from https://develop.svn.wordpress.org/trunk@53715


git-svn-id: http://core.svn.wordpress.org/trunk@53274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-18 17:37:17 +00:00
Sergey Biryukov
4e0b801910 Coding Standards: Use MINUTE_IN_SECONDS where appropriate.
This aims to clarify the time units for some timeout or expiration values.

Follow-up to [11823], [13177], [21996], [37747].

See #55647.
Built from https://develop.svn.wordpress.org/trunk@53714


git-svn-id: http://core.svn.wordpress.org/trunk@53273 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-17 02:18:09 +00:00
Sergey Biryukov
2cc9f73523 Editor: Include user's name in the wp_refresh_post_lock() response.
This ensures that the post lock data returned by the Heartbeat API is consistent.

Previously, `wp_check_locked_posts()` was updated to return the name of the user currently editing the post, but the `wp_refresh_post_lock()` response did not get a similar change.

Follow-up to [53070].

Props nathan.noom.
Fixes #56197.
Built from https://develop.svn.wordpress.org/trunk@53692


git-svn-id: http://core.svn.wordpress.org/trunk@53251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-11 18:18:13 +00:00
Sergey Biryukov
9177df1ee7 Docs: Improve description for wp_plugin_update_rows() and wp_theme_update_rows().
Follow-up to [53689].

See #55646.
Built from https://develop.svn.wordpress.org/trunk@53690


git-svn-id: http://core.svn.wordpress.org/trunk@53249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-09 12:59:11 +00:00
audrasjb
4f41d38512 Docs: Add missing function descriptions in wp-admin/includes/update.php.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-08 20:13:12 +00:00
audrasjb
0f3b3218c2 Menus: Use more appropriate escaping functions in class Walker_Nav_Menu_Edit.
This changeset replaces `esc_attr` escaping function with `esc_url` as it is more appropriate in the context of a link's `href` attribute.

Props audrasjb, aniketpatel.
Fixes #56108.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-05 08:06:17 +00:00
Sergey Biryukov
e70ac7004c Coding Standards: Escape the home URL in the "Background updated. Visit your site" message.
This affects `Custom_Background::admin_page()`.

Follow-up to [13041], [45662], [53642].

Props robinwpdeveloper, sajjad67, rudlinkon, hztyfoon, costdev.
Fixes #56133.
Built from https://develop.svn.wordpress.org/trunk@53643


git-svn-id: http://core.svn.wordpress.org/trunk@53202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-04 10:14:14 +00:00
Sergey Biryukov
eb08ad9160 Coding Standards: Escape the home URL in the "Header updated. Visit your site" message.
This affects `Custom_Image_Header::step_1()`.

Follow-up to [12890], [45654].

Props jakariaistauk, rudlinkon, hztyfoon, costdev.
Fixes #56132.
Built from https://develop.svn.wordpress.org/trunk@53642


git-svn-id: http://core.svn.wordpress.org/trunk@53201 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-04 10:11:12 +00:00
audrasjb
7c94f45bb0 Docs: Use third-person singular verbs for function descriptions in WP_Comments_List_Table class, as per docblock standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-04 08:20:15 +00:00
audrasjb
ec9b9bee76 Comments: Use more appropriate escaping functions in class WP_Comments_List_Table.
This changeset replaces `esc_attr` escaping function with `esc_html` as it is more appropriate in this context.

Props chintan1896, afragen, peterwilsoncc, SergeyBiryukov.
Fixes #56101.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-04 08:16:16 +00:00
audrasjb
a72203aa54 Docs: Add missing docblock description for install_themes_upload().
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-04 08:00:15 +00:00
Sergey Biryukov
79efd59bca Upgrade/Install: Add a conditional to facilitate testing of the Rollbacks feature project.
The [https://make.wordpress.org/core/2021/02/19/feature-plugin-rollback-update-failure/ Rollback Update Failure feature project] creates a temporary backup of plugins and themes before updating. This aims to make the update process more reliable and ensure that if a plugin or theme update fails, the previous version can be safely restored.

If the [https://wordpress.org/plugins/rollback-update-failure/ Rollback Update Failure plugin] is installed, `WP_Upgrader::install_package()` will use the `move_dir()` function from there for better performance. Instead of copying a directory from one location to another, it uses the `rename()` PHP function to speed up the process, which is instrumental in creating a temporary backup without a delay. If the renaming failed, it falls back to `copy_dir()` WP function.

This conditional aims to facilitate broader testing of the feature. It is temporary, until the plugin is merged into core.

Props afragen, pbiron, costdev, davidbaumwald, audrasjb, jrf, SergeyBiryukov.
Fixes #56057. See #51857, #54166.
Built from https://develop.svn.wordpress.org/trunk@53578


git-svn-id: http://core.svn.wordpress.org/trunk@53167 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-26 12:37:18 +00:00
Sergey Biryukov
7abd4bc951 Media: Use correct escaping function for URLs in some legacy media functions.
This affects:
* `get_image_send_to_editor()`
* `image_link_input_fields()`

Follow-up to [7092], [7874], [8653], [11109], [11204], [11383], [12051], [12199], [19982].

Props smit08, mukesh27.
Fixes #56064.
Built from https://develop.svn.wordpress.org/trunk@53570


git-svn-id: http://core.svn.wordpress.org/trunk@53159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-24 13:52:13 +00:00
Aaron Jorbin
a457e3498e Editor: Universalize functions for checking block editor status.
`use_block_editor_for_post_type` and `use_block_editor_for_post` can be very useful in more contexts than wp-admin, especially when a site is in transition. For example, you may want to do things on init that are different.

Neither function depends on other functions that are available only in wp-admin (other than use_block_editor_for_post() relying on use_block_editor_for_post_type() and an admin-referrer check that's historically gated by a query variable and now also gated by is_admin), therefore  moving them to wp-includes seems both feasible and beneficial

Props ethitter, jorbin.
Fixes #51819.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 18:48:13 +00:00
Sergey Biryukov
5d2e8afebd Code Modernization: Use the integer portion of an item position in add_submenu_page().
This fixes an `Implicit conversion from float to int loses precision` PHP 8.1 deprecation notice when adding a new admin menu item with a `float` value passed as the `$position` parameter.

This change is covered by existing unit tests and addresses 8 errors when running the test suite on PHP 8.1.

References:
* [https://php.watch/versions/8.1/deprecate-implicit-conversion-incompatible-float-string PHP 8.1: Implicit incompatible float to int conversion is deprecated]
* [https://wiki.php.net/rfc/implicit-float-int-deprecate PHP RFC: Deprecate implicit non-integer-compatible float to int conversions]

Follow-up to [52569], [53104].

Props jrf.
See #55656, #54798.
Built from https://develop.svn.wordpress.org/trunk@53555


git-svn-id: http://core.svn.wordpress.org/trunk@53144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-22 14:55:11 +00:00
Sergey Biryukov
b8290da037 Docs: Improve documentation for WP_Image_Editor::save() and related functions.
Includes:
* Documenting the returned array using hash notation.
* Adding a `@since` note for the `$filesize` value being included in the returned array.

This affects:
 * `wp_generate_attachment_metadata()`
 * `wp_get_attachment_metadata()`
 * `WP_Image_Editor::save()`
 * `WP_Image_Editor_GD::save()` and `::_save()`
 * `WP_Image_Editor_Imagick::save()` and `::_save()`

Follow-up to [22094], [22619], [52837], [53546].

See #55646.
Built from https://develop.svn.wordpress.org/trunk@53547


git-svn-id: http://core.svn.wordpress.org/trunk@53136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 11:18:17 +00:00
Sergey Biryukov
b352d32d8a Docs: Correct the return type for wp_save_image_file().
Since WordPress 3.5, `wp_save_image_file()` uses `WP_Image_Editor` classes under the hood to save the images.

While the `save()` method in those instances returns `array|WP_Error` and is documented as such, the return type of the `wp_save_image_file()` function was still left as `bool`.

A better solution would be to adjust the function to return the documented boolean type. However, doing that after 20+ major WP releases would be a backward compatibility break, so the documentation is now updated instead.

Includes:
* Documenting the returned array using hash notation.
* Adding a `@since` note for the `$image` parameter expecting a `WP_Image_Editor` instance.
* Adding a `@since` note for the `$filesize` value being included in the returned array.

Follow-up to [22094], [22619], [52837].

Props jrf, SergeyBiryukov.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@53546


git-svn-id: http://core.svn.wordpress.org/trunk@53135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 11:16:17 +00:00
audrasjb
bac638e610 Docs: Use third-person singular verbs for function descriptions in the Taxonomy Administration API.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-16 23:39:08 +00:00
audrasjb
8ea403e9bb Docs: Use third-person singular verbs for function descriptions in the WP_Screen API.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53103 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-16 23:10:10 +00:00
Sergey Biryukov
cacf46f12b Docs: Add a missing word in pre_months_dropdown_query filter description.
Follow-up to [50163].

See #55646.
Built from https://develop.svn.wordpress.org/trunk@53502


git-svn-id: http://core.svn.wordpress.org/trunk@53091 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 15:07:10 +00:00
Sergey Biryukov
3f74637dfe I18N: Use a translatable string for displaying a user's first name and last name.
That allows locales to switch the order of the first name and last name, should they prefer to do so.

The string was previously used in `wp_insert_user()` and is now reused in other places for consistency:

* `WP_MS_Users_List_Table::column_name()`​
* `WP_Users_List_Table::column_name()​`
* `wp_list_authors()`
* `wp_list_users()`

Note: This also removes the `wp_list_author_full_name` filter, introduced for the same purpose in `wp_list_authors()`, as redundant for now.

Follow-up to [53486].

See #17025.
Built from https://develop.svn.wordpress.org/trunk@53501


git-svn-id: http://core.svn.wordpress.org/trunk@53090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 14:43:12 +00:00
audrasjb
bbe60d66c3 Text Changes: Improve consistency of admin error notices.
This changeset replaces `<strong>Error</strong>:` with `<strong>Error:</strong>`, for better consistency.

Props transl8or, mihaidumitrascu, audrasjb.
Fixes #50785.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53047 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-02 15:05:13 +00:00
Sergey Biryukov
01d172b581 General: Replace all esc_url_raw() calls in core with sanitize_url().
This aims to improve performance by calling `sanitize_url()` directly, instead of the `esc_url_raw()` wrapper. As of WordPress 6.1, `sanitize_url()` is the recommended function for sanitizing a URL for database or redirect usage.

Follow-up to [11383], [13096], [51597], [53452].

Props benjgrolleau, peterwilsoncc, SergeyBiryukov.
Fixes #55852.
Built from https://develop.svn.wordpress.org/trunk@53455


git-svn-id: http://core.svn.wordpress.org/trunk@53044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-01 18:14:10 +00:00
Sergey Biryukov
9a2a423eb6 Quick/Bulk Edit: Check the show_in_quick_edit taxonomy property when processing the data for bulk edited posts.
Previously, setting the `show_in_quick_edit` property to `false` removed the taxonomy from the inline edit form, but several taxonomy-related database queries were still being performed in `bulk_edit_posts()` when building the arguments to pass to `wp_update_post()`, even though terms were not modified.

This commit improves performance by avoiding unnecessary database queries when `show_in_quick_edit` is `false`, and mirrors a similar check in the `get_inline_data()` function.

Follow-up to [13535], [14580], [31307], [52841], [53368].

Props Chouby, sabernhardt, costdev, nalininonstopnewsuk, webcommsat, marybaum, meher, wparslan, SergeyBiryukov.
Fixes #42474.
Built from https://develop.svn.wordpress.org/trunk@53449


git-svn-id: http://core.svn.wordpress.org/trunk@53038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-27 15:51:12 +00:00
Sergey Biryukov
653a3af0d4 Upgrade/Install: Update $_old_files for 6.0.
Props hellofromTonya, JeffPaul, SergeyBiryukov.
Fixes #55794.
Built from https://develop.svn.wordpress.org/trunk@53439


git-svn-id: http://core.svn.wordpress.org/trunk@53028 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-23 17:02:16 +00:00
Sergey Biryukov
40fc19024f Code Modernization: Replace phpversion() function calls with PHP_VERSION constant.
`phpversion()` return value and `PHP_VERSION` constant value are identical, but the latter is several times faster because it is a direct constant value lookup compared to a function call.

Props ayeshrajans, jrf, mukesh27, costdev, hellofromTonya, SergeyBiryukov.
Fixes #55680.
Built from https://develop.svn.wordpress.org/trunk@53426


git-svn-id: http://core.svn.wordpress.org/trunk@53015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-20 17:38:14 +00:00
Peter Wilson
ec3b0158d8 Themes: Accept valid block themes.
Updates theme validation to accept block themes. This replaces the requirement for an `index.php` with a requirement for either an `index.php`, `/templates/index.html` or the deprecated `/block-templates/index.html`.

Validation is updated for theme uploads, within `WP_Theme::__construct` and `validate_current_theme()`. 

A block theme using the deprecated file structure is now included in the unit tests.

Props peterwilsoncc, sergeybiryukov, hellofromtonya, costdev, azaozz, gziolo, FlorianBrinkmann, Boniu91, aristath, poena, audrasjb.
Fixes #55754.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53005 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-20 00:49:18 +00:00
Sergey Biryukov
4b46629139 Accessibility: List Tables: Hide the Comments column icon and title attribute from screen readers.
The element already has non-visual text, making the icon and the `title` attribute redundant for assistive technologies.

Follow-up to [22439], [27548], [31513], [32991], [50804].

Props sabernhardt, ryokuhi, afercia, karlgroves, SergeyBiryukov.
Fixes #55555. See #24766.
Built from https://develop.svn.wordpress.org/trunk@53414


git-svn-id: http://core.svn.wordpress.org/trunk@53003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-19 15:54:15 +00:00
ryelle
e8c02840a7 Administration: Update design of the Dashboard welcome panel.
This updates the panel to match the 6.0 About page styles, with the 6.0 graphic changing color based on the selected admin color scheme.

Props fcoveram, critterverse, joedolson, SergeyBiryukov.
Fixes #55532.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-10 16:45:08 +00:00
Sergey Biryukov
8c8b0a203a Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/template.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$parent` parameter to `$parent_page` in `parent_dropdown()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55650.
Built from https://develop.svn.wordpress.org/trunk@53364


git-svn-id: http://core.svn.wordpress.org/trunk@52953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-07 17:16:13 +00:00
Sergey Biryukov
7997df84a8 Site Health: Remove unused variables in WP_Site_Health::get_test_plugin_version().
Follow-up to [44986].

Props david.binda, mukesh27.
Fixes #55683.
Built from https://develop.svn.wordpress.org/trunk@53355


git-svn-id: http://core.svn.wordpress.org/trunk@52944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-05 16:29:08 +00:00
Peter Wilson
a34abb93b7 Quick/Bulk Edit: Remove duplicate HTML IDs.
Rename `#inline-edit-legend` to avoid duplicate HTML IDs. These have been renamed `#quick-edit-legend` and `#bulk-edit-legend` for the quick and bulk editors respectively.

This HTML ID is not required by the quick editor duplicated via JavaScript so is removed as part of the duplication process.

Follow up to [53096].

Props azaozz, costdev, greglone, hellofromtonya, ironprogrammer, joedolson, sabernhardt.
Fixes #55575.
See #35483.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-05 03:26:16 +00:00
audrasjb
4de4330b17 General: Add missing strong tag to some error messages.
This changeset adds missing `strong` tag to some error messages and updates some AJAX messages, for better consistency.

Follow-up to [53118].

Props NekoJonez, audrasjb, ocean90.
Fixes #54437.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-03 14:53:09 +00:00
Sergey Biryukov
056bbc95ea Docs: Improve plugin_install_action_links filter's docs.
Refer developers to `plugins_api()` for array of plugin data.

Follow-up to [53074], [53328].

Props afragen, pbiron.
See #55480.
Built from https://develop.svn.wordpress.org/trunk@53330


git-svn-id: http://core.svn.wordpress.org/trunk@52919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-02 13:07:14 +00:00
Peter Wilson
0fcdd744c1 Plugins: Improve plugin_install_description filter's docs.
Refer developers to `plugins_api()` for array of plugin data.

Props afragen, pbiron, SergeyBiryukov, costdev.
Fixes #55480.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52917 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-02 02:46:11 +00:00
John Blackbourn
bdaba2407c Docs: Improve documentation of the walker argument for various functions.
See #54729

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


git-svn-id: http://core.svn.wordpress.org/trunk@52907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-29 19:28:09 +00:00
Peter Wilson
ef8a32f6b9 Media: Validate track number ID3 tags before use.
Validate current and total track ID3 tags as numeric before use.

Props mjkhajeh, SergeyBiryukov, costdev.
Fixes #55204.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52896 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-29 04:50:12 +00:00
Sergey Biryukov
2334cea3e9 Bootstrap/Load: Move some more administration-related hooks to admin-filters.php.
Follow-up to [53266].

Fixes #54795.
Built from https://develop.svn.wordpress.org/trunk@53304


git-svn-id: http://core.svn.wordpress.org/trunk@52893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-28 16:39:11 +00:00
Mike Schroder
d9266d5bfd Media: Ensure wp_read_image_metadata filter returns array for $iptc and $exif.
Makes the behavior of the filter lines up with its documentation.
Previously, both `$iptc` and `$exif` could return `false` when `exif_read_data()` or `iptcparse()` failed.

Now, if those functions do not return an array, the results are explicitly set to `array()`.

Props volodymyrkolesnykov, SergeyBiryukov, sabernhardt, sumitsingh, mikeschroder.
Fixes #54637.
Built from https://develop.svn.wordpress.org/trunk@53303


git-svn-id: http://core.svn.wordpress.org/trunk@52892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-28 11:00:10 +00:00
John Blackbourn
c6dbcf8576 Docs: Various docblock corrections and improvements for changes introduced in 6.0.
See #54729

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


git-svn-id: http://core.svn.wordpress.org/trunk@52891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-28 09:59:13 +00:00
John Blackbourn
6aa053dc01 Docs: Various docblock improvements.
See #54729

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


git-svn-id: http://core.svn.wordpress.org/trunk@52888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-28 09:46:21 +00:00
Peter Wilson
da0ce4038f Media: Ensure wp_crop_image() returns correct file type.
Return the correct file path from `wp_crop_image()` when a developer modifies the file type with via the `image_editor_output_format` filter.

Previously the function would return a broken file reference containing the original file extension rather than the one specified via the filter.

Props mat-lipe, adamsilverstein.
Fixes #55403.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52881 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-27 05:21:08 +00:00
audrasjb
813c4d604c Bootstrap/load: Move administration related hooks to admin-filters.php.
This change moves some administration related hooks from `default-filters.php` to `admin-filters.php`. It also updates the `default-filters.php` docblock to indicate that contextualized hooks should be located in the most appropriate place.

Props dlh, hellofromTonya, antonvlasenko, audrasjb, azaozz.
Fixes #54795.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-26 06:32:08 +00:00
Peter Wilson
e9610a5d20 Administration: Trigger a notice for incorrect add_menu_page() parameter.
Trigger a notice (via `_doing_it_wrong()`) for developers incorrectly setting the position when calling `add_menu_page()`.

Modify a similar message in `add_submenu_page()` to combine near identical strings and match the error description to the conditions in which it is called.

Follow up to [52569], [53104].

Fixes #40927.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-26 02:59:08 +00:00
Sergey Biryukov
91ad9dbb07 Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/upgrade.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$public` parameter to `$is_public` in `wp_install()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53230


git-svn-id: http://core.svn.wordpress.org/trunk@52819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-20 10:46:09 +00:00
audrasjb
3d7603869b Docs: Misc fixes and improvements in the Administration Media API docblocks, as per documentation standards.
See #54729.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-20 08:29:08 +00:00
audrasjb
aab2815d58 Media: Remove attachment_fields_to_save filter and deprecate image_attachment_fields_to_save().
This filter prevented removing attachment titles. This changeset removes the filter and deprecates the related function since it is no longer used.

Props dromero20, desrosj, Junaidkbr, francina, antpb, audrasjb, aadilali, etaproducto, azouamauriac, Boniu91, SergeyBiryukov.
Fixes #39108.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-20 08:13:10 +00:00
Sergey Biryukov
eeb9f68181 Menus: Use correct parameter in _wp_nav_menu_meta_box_object().
Follow-up to [53220].

Props davidbaumwald.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53222


git-svn-id: http://core.svn.wordpress.org/trunk@52811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-19 15:59:10 +00:00
Sergey Biryukov
9ce061ae8c Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/template.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$echo` parameter to `$display` in:
 * `wp_popular_terms_checklist()`
 * `_post_states()`
 * `_media_states()`
* Renames the `$default` parameter to `$default_term` in `wp_popular_terms_checklist()`.
* Renames the `$default` parameter to `$default_template` in `page_template_dropdown()`.
* Renames the `$default` parameter to `$default_page` in `parent_dropdown()`.
* Renames the `$object` parameter to `$data_object` in:
 * `do_block_editor_incompatible_meta_box()`
 * `do_meta_boxes()`
 * `do_accordion_sections()`
* Amends the `$item_object` parameter in other functions for consistency:
 * `wp_nav_menu_item_post_type_meta_box()`
 * `wp_nav_menu_item_taxonomy_meta_box()`
 * `_wp_nav_menu_meta_box_object()`

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53220


git-svn-id: http://core.svn.wordpress.org/trunk@52809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-19 15:13:08 +00:00
Sergey Biryukov
05d12bfa4c Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/taxonomy.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$parent` parameter to `$category_parent` in `category_exists()` and `wp_create_category()`. This matches the category object property of the same name.
* Amends similar parameters in `dropdown_categories()` and `wp_dropdown_cats()` for consistency.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53216


git-svn-id: http://core.svn.wordpress.org/trunk@52805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-19 13:51:08 +00:00
Sergey Biryukov
90cbd98c6b Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/plugin.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$function` parameter to `$callback` in:
 * `add_menu_page()`
 * `add_submenu_page()`
 * `add_management_page()`
 * `add_options_page()`
 * `add_theme_page()`
 * `add_plugins_page()`
 * `add_users_page()`
 * `add_dashboard_page()`
 * `add_posts_page()`
 * `add_media_page()`
 * `add_links_page()`
 * `add_pages_page()`
 * `add_comments_page()`
* Renames the `$echo` parameter to `$display` in `menu_page_url()`.
* Renames the `$parent` parameter to `$parent_page` in `get_admin_page_parent()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53215


git-svn-id: http://core.svn.wordpress.org/trunk@52804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-19 12:48:08 +00:00
Sergey Biryukov
c4c4edccc0 Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/nav-menu.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$echo` parameter to `$display` in `wp_nav_menu_disabled_check()`.
* Renames the `$object` parameter to `$item_object` in:
 * `wp_nav_menu_item_post_type_meta_box()`
 * `wp_nav_menu_item_taxonomy_meta_box()`
 * `_wp_nav_menu_meta_box_object()`

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53207


git-svn-id: http://core.svn.wordpress.org/trunk@52796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-18 15:22:08 +00:00
Sergey Biryukov
f53b215bfe Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/ms.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$echo` parameter to `$display_message` in `upload_is_user_over_quota()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53203


git-svn-id: http://core.svn.wordpress.org/trunk@52792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-18 10:33:09 +00:00
Sergey Biryukov
99de4aea45 Docs: Use third-person singular verbs for function descriptions in wp-admin/includes/meta-boxes.php, per the documentation standards.
See #54729.
Built from https://develop.svn.wordpress.org/trunk@53201


git-svn-id: http://core.svn.wordpress.org/trunk@52790 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-17 17:57:09 +00:00
Sergey Biryukov
9043ef83ef Docs: Add missing descriptions for function parameters in wp-admin/includes/meta-boxes.php.
See #54729.
Built from https://develop.svn.wordpress.org/trunk@53200


git-svn-id: http://core.svn.wordpress.org/trunk@52789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-17 17:47:13 +00:00
Sergey Biryukov
6c36a0867d Coding Standards: Simplify long conditions in xfn_check().
Add some comments for clarity.

Follow-up to [2051], [4990], [53198].

See #54728.
Built from https://develop.svn.wordpress.org/trunk@53199


git-svn-id: http://core.svn.wordpress.org/trunk@52788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-17 17:26:08 +00:00
Sergey Biryukov
447bd92f5d Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/meta-boxes.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$class` parameter to `$xfn_relationship` in `xfn_check()`.
* Renames the `$value` parameter to `$xfn_value` for clarity.
* Includes minor code layout changes for better readability.

Reference: [http://gmpg.org/xfn/join XFN: Getting Started].

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53198


git-svn-id: http://core.svn.wordpress.org/trunk@52787 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-17 15:37:09 +00:00
Sergey Biryukov
8a6d7ea5ac Coding Standards: Correct the $items_count variable in add_menu_classes().
Follow-up to [53195].

See #54728.
Built from https://develop.svn.wordpress.org/trunk@53196


git-svn-id: http://core.svn.wordpress.org/trunk@52785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-17 14:44:07 +00:00
Sergey Biryukov
b32080c332 Coding Standards: Use more descriptive variable names in add_menu_classes().
Follow-up to [9578], [53193], [53194].

See #54728.
Built from https://develop.svn.wordpress.org/trunk@53195


git-svn-id: http://core.svn.wordpress.org/trunk@52784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-17 14:41:08 +00:00
Sergey Biryukov
a30a1efac4 Docs: Add missing documentation for add_cssclass() and add_menu_classes().
Follow-up to [9578], [53193].

See #54729.
Built from https://develop.svn.wordpress.org/trunk@53194


git-svn-id: http://core.svn.wordpress.org/trunk@52783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-17 14:30:13 +00:00
Sergey Biryukov
f6b7a1fd7a Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/menu.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$class` parameter to `$classes` in `add_cssclass()`.
* Renames the `$add` parameter to `$class_to_add` for clarity.
* Includes minor code layout changes for better readability. 

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53193


git-svn-id: http://core.svn.wordpress.org/trunk@52782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-17 14:10:07 +00:00
Sergey Biryukov
88cce3c705 Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/media.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$return` parameter to `$return_type` in `media_sideload_image()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53192


git-svn-id: http://core.svn.wordpress.org/trunk@52781 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-17 10:51:10 +00:00
Sergey Biryukov
ad5deed830 Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/list-table.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$class` parameter to `$class_name` in `_get_list_table()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53185


git-svn-id: http://core.svn.wordpress.org/trunk@52774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-15 10:52:11 +00:00
Sergey Biryukov
e86b90cad6 Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/deprecated.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$default` and `$parent` parameters to `$default_category` and `$parent_category` in `dropdown_categories()`.
* Renames the `$default` parameter to `$default_link_category` in `dropdown_link_categories()`.
* Renames the `$parent` parameter to `$parent_cat` and some other parameters for consistency in `wp_dropdown_cats()`.
* Renames the `$function` to `$callback` in `add_object_page()` and `add_utility_page()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53184


git-svn-id: http://core.svn.wordpress.org/trunk@52773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-14 15:26:09 +00:00