Commit Graph

1412 Commits

Author SHA1 Message Date
joedolson
e6cfabe956 Media: Protect mime type icon function from simple errors.
Handle `$preferred_ext` arguments that are passed with minor errors in formatting, such as incorrect casing or missing `.`. Add unit tests to verify that an omitted period on an otherwise correct extension is accepted. Follow up to [57687].

Props sabernhardt, joedolson, khokansardar.
Fixes #60610.
Built from https://develop.svn.wordpress.org/trunk@58248


git-svn-id: http://core.svn.wordpress.org/trunk@57711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 13:03:12 +00:00
Pascal Birchler
87a182ab6f REST API: Refactor global styles endpoints in REST API to register with post type.
Updated the global styles endpoints in the REST API to extend from existing posts and revisions controllers. This reduces duplicated code and inconsistencies. The revisions controller is now a subclass of the `WP_REST_Revisions_Controller`. Related redundant methods were removed and schema generation and collection parameters were adjusted to suit the global styles context. Updated permission checks, constructor, and collection parameters accordingly. This change allows for easy override of these classes using the `register_post_type_args` filter.

This reintroduces [57624] (reverted in [57628]) with improved backward compatibility and further enhancements.

Props ramonopoly, spacedmonkey, mukesh27, swissspidy.
Fixes #60131.
Built from https://develop.svn.wordpress.org/trunk@58225


git-svn-id: http://core.svn.wordpress.org/trunk@57688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-28 12:40:16 +00:00
Pascal Birchler
3504e15aa9 Posts, Post Types: Autosave: Allow disabling autosave support per post type.
Not all post types support autosaving. By making autosave a post type feature, support can be more granularly handled without any workarounds or hardcoded allowlists. `wp_font_family` and `wp_font_face` are examples of built-in post types which do not support autosave.

For backward compatibility reasons, adding `editor` support implies `autosave` support, so one would need to explicitly use `remove_post_type_support()` to remove it again.

Props swissspidy, youknowriad, hellofromtonya, peterwilsoncc.
Fixes #41172.
Built from https://develop.svn.wordpress.org/trunk@58201


git-svn-id: http://core.svn.wordpress.org/trunk@57664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 09:06:16 +00:00
Sergey Biryukov
eba0df8c7b Docs: Correct the placement of @global tags in various files.
Follow-up to [6589], [8598], [10798], [25490], [25594], [31192], [31194], [35718], [37437], [44169], [44948], [45247], [56763], [56773], [57370], [57503].

Props shailu25.
Fixes #61295.
Built from https://develop.svn.wordpress.org/trunk@58200


git-svn-id: http://core.svn.wordpress.org/trunk@57663 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-26 20:51:13 +00:00
Sergey Biryukov
0d6e7f33c4 Editor: Add excerpt support to the wp_block post type.
The purpose is to enable using the excerpt as a description for user-created patterns on the Site Editor Pattern screens.

This commit backports the original PR from Gutenberg repository:
* [[https://github.com/WordPress/gutenberg/pull/60549|#60549: [Data Views] User patterns: Use excerpt as description]]

Reference: [[https://github.com/WordPress/gutenberg/issues/55244|#55244: Patterns: Add descriptions to user-created patterns]].

Follow-up to [44146], [44150], [50835], [56030].

Props poena, ntsekouras, krupalpanchal.
Fixes #61250.
Built from https://develop.svn.wordpress.org/trunk@58184


git-svn-id: http://core.svn.wordpress.org/trunk@57647 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-23 13:41:58 +00:00
Sergey Biryukov
1251cb8c5e Coding Standards: Rewrite an empty conditional in get_post_status().
Expand the comment to further clarify the post object check performed.

Follow-up to [58174].

See #59283.
Built from https://develop.svn.wordpress.org/trunk@58175


git-svn-id: http://core.svn.wordpress.org/trunk@57638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-20 13:44:15 +00:00
youknowriad
e1034e15f0 Posts: Ensure get_sample_permalink returns the right permalink for auto-draft posts.
The post editor uses the permalink_template property from the posts REST API to render the post slug input or not. For auto-drafts or newly created posts, this property was not set properly. This PR solves by fixing the get_sample_permalink function used to compute this property.

Props youknowriad, mcsf, antonvlasenko, azaozz, peterwilsoncc, andrewserong, hellofromTonya, spacedmonkey.
Fixes #59283.
Built from https://develop.svn.wordpress.org/trunk@58174


git-svn-id: http://core.svn.wordpress.org/trunk@57637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-20 09:49:16 +00:00
audrasjb
1abb7e0563 Editor: Add item_updated label for wp_template and wp_template_part post types.
This adds the `item_updated` label to Template and Template Part post types registration. This prevents from displaying the default `post updated` label.
See https://github.com/WordPress/gutenberg/pull/61146 

Follow-up to [52062], [51003].

Props ntsekouras, ellatrix.
Fixes #61095.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-29 22:32:08 +00:00
Pascal Birchler
00d06db33d Docs: Fix various typos and spelling mistakes.
Props swissspidy, jucaduca, sergeybiryukov.
See #60699.
Built from https://develop.svn.wordpress.org/trunk@57987


git-svn-id: http://core.svn.wordpress.org/trunk@57473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-12 17:47:13 +00:00
Sergey Biryukov
31039a896f Coding Standards: Rename the remaining $postid instances in wp_delete_post().
Follow-up to [57853], [57857].

See #60700.
Built from https://develop.svn.wordpress.org/trunk@57858


git-svn-id: http://core.svn.wordpress.org/trunk@57359 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-03-19 18:04:15 +00:00
Sergey Biryukov
f09287b6e1 Coding Standards: Rename the $postid parameter to $post_id in wp_delete_post().
This matches the parameter name in `wp_trash_post()` and all the other functions receiving post ID as a parameter.

See #60700.
Built from https://develop.svn.wordpress.org/trunk@57857


git-svn-id: http://core.svn.wordpress.org/trunk@57358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-03-19 17:47:10 +00:00
Pascal Birchler
5cb687dbce Posts, Post Types: Introduce delete_post_{$post->post_type} and deleted_post_{$post->post_type} hooks.
The hooks fire before the general `delete_post` / `deleted_post` hooks and have the same parameters.

They complement the `save_post_{$post->post_type}` hook added in [25050] and the `edit_post_{$post->post_type}` hook added in [43617].

Props benniledl, swissspidy, dargus.
Fixes #60433.
Built from https://develop.svn.wordpress.org/trunk@57853


git-svn-id: http://core.svn.wordpress.org/trunk@57354 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-03-19 09:33:11 +00:00
joedolson
c6c7d5080a Media: Fall back to available icons if SVG media icons not found.
Follow up to [57687]. If no icons of the preferred type are available, then the icon array should return the collection of valid icons found, rather than an empty array.

Props sabernhardt, swissspidy, sabernhardt, antpb, joedolson.
Fixes #60740.
Built from https://develop.svn.wordpress.org/trunk@57845


git-svn-id: http://core.svn.wordpress.org/trunk@57346 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-03-15 16:37:11 +00:00
Sergey Biryukov
096df041b6 Docs: Add a @since note for $preferred_ext parameter in wp_mime_type_icon().
Follow-up to [57687].

See #31352.
Built from https://develop.svn.wordpress.org/trunk@57701


git-svn-id: http://core.svn.wordpress.org/trunk@57202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-23 09:43:12 +00:00
joedolson
5fd767d87d Media: Ensure wp_mine_type_icon() returns expected file type.
Add an argument to `wp_mime_type_icon()` to control the file type returned. Following [57638], there are two file formats in the media icons directory. Different systems would pull up different files by default dependent on the order loaded into the cached array, causing intermittent test failures and unpredictable behavior.

Function update allows core usages to always return the `.svg` while maintaining backwards compatibility for any extended usage that expects a `.png`. Follow up to [57638].

Also handles a missed case in media list view.

Props SergeyBiryukov, sabernhardt, joedolson, antpb.
Fixes #31352.
Built from https://develop.svn.wordpress.org/trunk@57687


git-svn-id: http://core.svn.wordpress.org/trunk@57188 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-21 19:29:04 +00:00
John Blackbourn
eadb61542a Docs: Various improvements and corrections to inline documentation.
See #59651

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


git-svn-id: http://core.svn.wordpress.org/trunk@57145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-16 21:47:12 +00:00
joedolson
ae111b182a Media: Replace media icon images with SVG.
Replace the `.png` files in use for media library type icons with `.svg` versions. Improves sharpness, especially on high resolution screens and devices.

Props iseulde, melchoyce, joemcgill, sabernhardt, huzaifaalmesbah, wonderboymusic, ocean90, karmatosed, boemedia, bosskhj, joedolson.
Fixes #31352.
Built from https://develop.svn.wordpress.org/trunk@57638


git-svn-id: http://core.svn.wordpress.org/trunk@57139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-15 23:49:10 +00:00
davidbaumwald
99396f6c86 REST API: Revert the refactor of global styles endpoints in REST API in [57624].
[57624] introduced some E2E test failures which are the result of an incompatibility with the Gutenberg plugin.

Props jorbin, spacedmonkey, swissspidy, hellofromTonya, youknowriad, costdev.
See #60131.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-13 15:13:17 +00:00
spacedmonkey
de3ee0fde6 REST API: Refactor global styles endpoints in REST API to register with post type.
Updated the global styles endpoints in the REST API to extend from existing posts and revisions controllers. This reduces duplicated code and inconsistencies. The revisions controller is now a subclass of the WP_REST_Revisions_Controller. Related redundant methods were removed and schema generation and collection parameters were adjusted to suit the global styles context. Updated permission checks, constructor, and collection parameters accordingly. This change allows for easy override of these classes using the `register_post_type_args` filter. 

Props ramonopoly, spacedmonkey, mukesh27.
Fixes #60131.
Built from https://develop.svn.wordpress.org/trunk@57624


git-svn-id: http://core.svn.wordpress.org/trunk@57125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-13 14:09:08 +00:00
youknowriad
b7725a50d3 REST API: Introduce the necessary endpoints for the font library.
This commits add three endpoints to retrieve and manipulate fonts in WordPress.
This commit also means that we now have a fully functional Font Library in the site editor.

Props get_dave, youknowriad, mmaattiiaass, grantmkin, swissspidy, mcsf, jorbin, ocean90.
See #59166.
Built from https://develop.svn.wordpress.org/trunk@57548


git-svn-id: http://core.svn.wordpress.org/trunk@57049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-07 09:20:08 +00:00
Pascal Birchler
892d83f1eb Coding Standards: Fix array key alignment after [57539].
See #59166.
Built from https://develop.svn.wordpress.org/trunk@57541


git-svn-id: http://core.svn.wordpress.org/trunk@57042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-06 10:58:13 +00:00
youknowriad
ea8080d8c8 Editor: Introduce the Font Library post types and low level APIs.
This is the first step towards adding the font library to WordPress.
This commit includes the font library and font face CPTs.
It also adds the necessary APIs and classes to register and manipulate font collections.

This PR backports the font library post types and low level APIs to Core. This is the first step to include the font library entirely into Core. Once this merged, we'll open a PR with the necessary REST API controllers.

Props youknowriad, get_dave, grantmkin, swissspidy, hellofromtonya, mukesh27, mcsf.
See #59166.
Built from https://develop.svn.wordpress.org/trunk@57539


git-svn-id: http://core.svn.wordpress.org/trunk@57040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-06 08:42:12 +00:00
Adam Silverstein
f94f194552 Media: enable AVIF support.
Add support for uploading, editing and saving AVIF images when supported by the server.

Add 'image/avif' to supported mime types. Correctly identify AVIF images and sizes even when PHP doesn't support AVIF. Resize uploaded AVIF files (when supported) and use for front end markup.

Props adamsilverstein, lukefiretoss, ayeshrajans, navjotjsingh, Tyrannous, jb510, gregbenz, nickpagz, JavierCasares, mukesh27, yguyon, swissspidy.
Fixes #51228.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57025 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-02 17:48:15 +00:00
joedolson
ea9bf63acc Media: Fix inaccurate docs for wp_attachment_is().
Correct the documentation for the `$type` parameter to accept file extensions as well as attachment type groups. Also fix the return description to reflect the change.

Props nirav7707, joedolson.
Fixes #59698.
Built from https://develop.svn.wordpress.org/trunk@57273


git-svn-id: http://core.svn.wordpress.org/trunk@56779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-12 16:49:16 +00:00
hellofromTonya
d30fe43245 Docs: Replace "sanity" with "confidence" for inclusive language.
The phrase "sanity check" unnecessarily references mental health. It's an old phrase used to denote an extra step in verifying code works as expected.

“The WordPress open source community cares about diversity. We strive to maintain a welcoming environment where everyone can feel included.”

While "sanity check" is a well-known phrase with a specific meaning, "confidence check" is a direct replacement that is more clear of its intent while being more inclusive.

Words matter.

Follow-up to [49216], [46271], [40583], [38832], [38637], [37409], [33359], [32162], [30346], [30345], [30238], [30055], [29902], [28763], [26141], [25002], [22227], [13428], [12148], [11025], [8927].

Props dartiss, hellofromTonya.
Fixes #60187.
Built from https://develop.svn.wordpress.org/trunk@57239


git-svn-id: http://core.svn.wordpress.org/trunk@56745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-03 21:59:19 +00:00
Sergey Biryukov
42c693e244 Docs: Add missing argument type for supports in register_post_type().
If set to `false`, no feature support is registered for the post type.

Follow-up to [12751], [20734], [29091], [37883].

Props jeremyfelt, swissspidy.
Fixes #59690.
Built from https://develop.svn.wordpress.org/trunk@57150


git-svn-id: http://core.svn.wordpress.org/trunk@56661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-03 20:01:29 +00:00
Peter Wilson
4258f31a3b Query: Cache post parent IDs in posts group.
Move the cache of post parent IDs from the dedicated group `post_parents` to `posts`. This maintains backward compatibility for clearing all post object related data by calling `wp_cache_flush_group( 'posts' )`.

Post parent IDs are now cached with with the prefix `post_parent:` in the `posts` group.

Follow up to [56763].

Props spacedmonkey, joemcgill, peterwilsoncc.
See #59188.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 23:41:23 +00:00
spacedmonkey
6e774df98c REST API: Fix issue with Template and Template Part Revision/Autosave REST API controllers.
The Template and Template Part REST API controllers have unique characteristics compared to other post type REST API controllers. They do not rely on integer IDs to reference objects; instead, they use a combination of the theme name and slug of the template, like 'twentytwentyfour//home.' Consequently, when the post types template and template part were introduced in [52062], it led to the registration of REST API endpoints for autosaves and revisions with invalid URL structures.

In this commit, we introduce new functionality to enable custom autosave and revisions endpoints to be registered at the post type level. Similar to the 'rest_controller_class' parameter, developers can now define 'revisions_rest_controller' and 'autosave_rest_controller.' This empowers developers to create custom controllers for these functionalities. Additionally, we introduce a 'late_route_registration' parameter, which proves helpful when dealing with custom URL patterns and regex pattern matching issues.
This commit registers new classes for template and template part autosave and revisions controllers, differentiating them from standard controllers in the following ways:
* The response shape now matches that of the template controller.
* Permission checks align with the template controller.
* A custom URL pattern is introduced to support slug-based identification of templates.

Furthermore, we've updated the utility function '_build_block_template_result_from_post' to support passing revision post objects. This enhancement ensures compatibility with the custom revisions controller.

Props spacedmonkey, revgeorge, andraganescu, hellofromTonya, antonvlasenko, kadamwhite, ironprogrammer, costdev, mukesh27, timothyblynjacobs, adamsilverstein. 
Fixes 56922.
Built from https://develop.svn.wordpress.org/trunk@56819


git-svn-id: http://core.svn.wordpress.org/trunk@56331 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-10 14:05:21 +00:00
Peter Wilson
61658a27a3 Query: Rename _prime_post_parents_caches() for clarity.
Change the name of `_prime_post_parents_caches()` to `_prime_post_parent_id_caches()` to make it clearer only the parent post ID is cached rather than the entire post parent object.

Follow up to [56763].

Props spacedmonkey, joemcgill, peterwilsoncc.
See #59188.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-09 23:04:16 +00:00
spacedmonkey
eb0c7d8864 Docs: Improve documentation for _prime_post_parents_caches().
Add in missing since PHPDoc block for `_prime_post_parents_caches` function added in [56763].

Props mukesh27.
See #59188
Built from https://develop.svn.wordpress.org/trunk@56773


git-svn-id: http://core.svn.wordpress.org/trunk@56285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 12:16:22 +00:00
spacedmonkey
5283300aac Query: Improve caching behavior for WP_Query when retrieving id=>parent fields
In [53941], the addition of query caching to `WP_Query` brought about an unintended issue when querying for fields equal to id=>parent. Specifically, on websites with object caching enabled and a substantial number of pages, the second run of this query triggered the `_prime_post_caches` function for id=>parent. This led to the unnecessary priming of post, meta, and term caches, even when only id and parent information were requested.

This commit addresses this issue by introducing a new function, `_prime_post_parents_caches`, which primes a dedicated cache for post parents. This cache is primed during the initial query execution. Subsequently, the `wp_cache_get_multiple` function is employed to retrieve all post parent data in a single object cache request, optimizing performance.

Additionally, this commit extends the coverage of existing unit tests to ensure the reliability of the changes.

Props kevinfodness, joemcgill, peterwilsoncc, LinSoftware, thekt12, spacedmonkey.
Fixes #59188
Built from https://develop.svn.wordpress.org/trunk@56763


git-svn-id: http://core.svn.wordpress.org/trunk@56275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 15:01:21 +00:00
hellofromTonya
61003dc0e7 Media: Change link text when attachment pages disabled.
When attachment pages are disabled, change the links from "View Attachment Page" to "View Media File".

Follow-up to [56657], [56658].

Props joedolson, ironprogrammer, oglekler.
Fixes #57913.
Built from https://develop.svn.wordpress.org/trunk@56711


git-svn-id: http://core.svn.wordpress.org/trunk@56223 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 14:45:23 +00:00
Sergey Biryukov
114a672cfa Coding Standards: Upgrade WPCS to version 3.0.0.
This is an important release which makes significant changes to improve the accuracy, performance, stability and maintainability of all sniffs, as well as making WordPressCS much better at handling modern PHP.

WordPressCS 3.0.0 contains breaking changes, both for people using ignore annotations, people maintaining custom rulesets, as well as for sniff developers who maintain a custom PHPCS standard based on WordPressCS.

If you are an end-user or maintain a custom WordPressCS based ruleset, please start by reading the [https://github.com/WordPress/WordPress-Coding-Standards/wiki/Upgrade-Guide-to-WordPressCS-3.0.0-for-ruleset-maintainers Upgrade Guide to WordPressCS 3.0.0 for ruleset maintainers] which lists the most important changes and contains a step by step guide for upgrading.

If you are a maintainer of an external standard based on WordPressCS and any of your custom sniffs are based on or extend WordPressCS sniffs, please read the [https://github.com/WordPress/WordPress-Coding-Standards/wiki/Upgrade-Guide-to-WordPressCS-3.0.0-for-Developers-of-external-standards Upgrade Guide to WordPressCS 3.0.0 for Developers].

In all cases, please read the complete changelog carefully before you upgrade.

This commit:
* Updates the Composer dependencies to use the new version, including updating the underlying PHP_CodeSniffer dependency to the new minimum supported version for WPCS.[[BR]] Note: the Composer PHPCS installer plugin is no longer explicitly required as it is now a dependency of WPCS, so the dependency is inherited automatically.
* Updates the ruleset for WPCS 3.0.0. This includes:
 * Raising the memory limit to be on the safe side as WPCS 3.0.0 contains a lot more sniffs.
 * Removing explicit inclusions of extra rules, which have now been added to the `WordPress-Core` ruleset..
 * Updating property names for select sniffs.
 * Updating one exclusion — the `WordPress.CodeAnalysis.AssignmentInCondition` sniff has been (partially) replaced by the `Generic.CodeAnalysis.AssignmentInCondition` sniff.
 * Adding one new exclusion.
* Downgrades one new error to a warning.[[BR]] The `Generic.Files.OneObjectStructurePerFile` sniff enforces that there is only one OO structure declaration per file. At this time, this sniff would yield 29 errors. By downgrading the sniff to a ''warning'', the build can pass and the issues can be fixed in due time. For now, the test directory will be excluded until the issues are fixed (as the test directory CS run does not allow for warnings).
* Updates ignore annotations for WPCS 3.0.0.

Reference: [https://github.com/WordPress/WordPress-Coding-Standards/releases/tag/3.0.0 WPCS 3.0.0 release notes].

Follow-up to [43571], [44574], [45600], [47927].

Props jrf, jorbin, desrosj.
See #59161.
Built from https://develop.svn.wordpress.org/trunk@56695


git-svn-id: http://core.svn.wordpress.org/trunk@56207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 00:27:12 +00:00
Joe McGill
0475a61f8a Media: Edit new hook name in get_available_post_mime_types().
This is a follow-up to [56452] in which a new filter hook was added to `get_available_post_mime_types()` to override a potentially slow query. This renames the previous hook from `get_available_post_mime_types` to `pre_get_available_post_mime_types` for clarity.

Props rcorrales, emrikol, johnbillion, joemcgill, mukesh27.
Fixes #52759.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 17:05:21 +00:00
isabel_brison
da2581b4c1 Post Types: allow trashing draft patterns.
Adds `delete_posts` to capabilities for the `wp_block` post type.

Props ramonopoly, johnbillion, dhruvishah2203, audrasjb.
Fixes #59041.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56089 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 05:53:11 +00:00
Sergey Biryukov
e5490118af Coding Standards: Include one space after function keyword for closures.
Note: This is enforced by WPCS 3.0.0.

Reference: [https://github.com/WordPress/WordPress-Coding-Standards/pull/2328 WPCS: PR #2328 Core: properly check formatting of function declaration statements].

Props jrf.
See #59161, #58831.
Built from https://develop.svn.wordpress.org/trunk@56559


git-svn-id: http://core.svn.wordpress.org/trunk@56071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-12 15:23:18 +00:00
Sergey Biryukov
b80ce60f70 Coding Standards: Use pre-increment/decrement for stand-alone statements.
Note: This is enforced by WPCS 3.0.0:

1. There should be no space between an increment/decrement operator and the variable it applies to.
2. Pre-increment/decrement should be favoured over post-increment/decrement for stand-alone statements. “Pre” will in/decrement and then return, “post” will return and then in/decrement. Using the “pre” version is slightly more performant and can prevent future bugs when code gets moved around.

References:
* [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#increment-decrement-operators WordPress PHP Coding Standards: Increment/decrement operators]
* [https://github.com/WordPress/WordPress-Coding-Standards/pull/2130 WPCS: PR #2130 Core: add sniffs to check formatting of increment/decrement operators]

Props jrf.
See #59161, #58831.
Built from https://develop.svn.wordpress.org/trunk@56549


git-svn-id: http://core.svn.wordpress.org/trunk@56061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-09 09:28:26 +00:00
Sergey Biryukov
d8936a9fe7 Coding Standards: Remove superfluous blank lines at the end of various functions.
Note: This is enforced by WPCS 3.0.0.

Follow-up to [56536], [56547].

Props jrf.
See #59161, #58831.
Built from https://develop.svn.wordpress.org/trunk@56548


git-svn-id: http://core.svn.wordpress.org/trunk@56060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-08 10:03:21 +00:00
Sergey Biryukov
f69316e8a5 Docs: Add a @since note for add_new labels change in get_post_type_labels().
Includes removing an obsolete recommendation to use a gettext context matching the post type for disambiguation, which would be redundant with the new labels, as they already include the type of content.

Follow-up [14571], [56515].

See #47125.
Built from https://develop.svn.wordpress.org/trunk@56519


git-svn-id: http://core.svn.wordpress.org/trunk@56031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-06 00:46:24 +00:00
joedolson
0aa0c763e2 Administration: Add improved context for add new links.
Consistently expand `Add New` links to include the type of content to add. Improve consistency of text casing to use initial caps throughout.

Props afercia, gonzomir, alexstine, swissspidy, joedolson.
Fixes #47125.
Built from https://develop.svn.wordpress.org/trunk@56515


git-svn-id: http://core.svn.wordpress.org/trunk@56027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-05 19:26:26 +00:00
Joe McGill
3087927a5f Posts, Post Types: Avoid redundant SQL query in get_pages().
This avoids an additional query by passing the query args directly to the `WP_Query::query()` method, rather than to the constructor and calling get_posts(), following [55569].

Props david.binda, azaozz, spacedmonkey, mukesh27, flixos90, SergeyBiryukov, joemcgill.
Fixes #59224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-29 22:13:18 +00:00
Joe McGill
c15220ee49 Posts, Post Types: Reinstate missing sort_column options in get_pages().
This fixes an issue introduced in [55569] that broke sort ordering by `post_modified_gmt` or `modified_gmt`.

Props david.binda, azaozz, spacedmonkey, flixos90, joemcgill.
Fixes #59226.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-29 22:05:23 +00:00
John Blackbourn
aa8ba65a34 Media: Add a filter to the get_available_post_mime_types() function to allow overriding its database query.
This introduces the `get_available_post_mime_types` filter so this query can be skipped or cached by plugins.

Props maciejmackowiak, archon810, rcorrales

Fixes #52759

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


git-svn-id: http://core.svn.wordpress.org/trunk@55964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 16:55:18 +00:00
John Blackbourn
4667b9323f Docs: Miscellaneous docblock corrections and improvements.
See #58833

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


git-svn-id: http://core.svn.wordpress.org/trunk@55926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-18 17:29:20 +00:00
isabel_brison
2997b17eb7 Editor: update string incorrectly marked for translation in Chrome.
Update the Pattern post type `edit_item` label to be `Edit Block Pattern` instead of `Edit Pattern` so Chrome doesn’t open the translation modal.

Props andrewserong,, ramonopoly, eric.7186, audrasjb, wildworks, Toro_Unit.
Fixes #58716.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-11 05:10:23 +00:00
audrasjb
6263f22b10 Docs: Replace multiple single line comments with multi-line comments.
This changeset updates various comments as per WordPress PHP Inline Documentation Standards.
See https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#5-inline-comments.

Follow-up to [56174], [56175], [56176], [56177], [56178], [56179], [56180], [56191].

Props costdev, audrasjb.
See #58459.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-10 22:48:22 +00:00
isabel_brison
ab8c2bd924 Editor: rename sync_status and move it to top level.
Renames sync_status to wp_pattern_sync_status and moves it to top level field of wp_block post type.

Props glendaviesnz, aaronrobertshaw, mukesh27, peterwilsoncc.
Fixes 58677.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-07 07:29:23 +00:00
Sergey Biryukov
afa826e356 Docs: Correct @return description for wp_count_posts().
Add a note that `wp_count_posts()` returns an empty object if the post type passed to the function does not exist.

Follow-up to [6730], [6808], [8081], [24826], [29093], [51885].

Props crstauf, Ov3rfly.
Fixes #58685.
Built from https://develop.svn.wordpress.org/trunk@56120


git-svn-id: http://core.svn.wordpress.org/trunk@55632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-01 10:04:26 +00:00
isabel_brison
f3f4f7dd96 Editor: fix post edit navigation link.
Adds a custom link for navigation post types.

Props get_dave, spacedmonkey, ramonopoly.
Fixes #58589.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55565 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-27 06:02:22 +00:00
audrasjb
d61ec19da0 Posts, Post Types: Add a $previous_status parameter to wp_trash_post() related hooks.
This adds a `$previous_status` parameter to the `pre_trash_post`, `wp_trash_post`, and `trashed_post` hooks.

Props mujuonly, mukesh27, nihar007, dhruvishah2203, SergeyBiryukov, costdev, hugod, audrasjb, oglekler.
Fixes #58392.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-26 20:57:22 +00:00