Commit Graph

1311 Commits

Author SHA1 Message Date
desrosj
5932a68ba6 Posts, Post Types: Mark the wp_global_styles post type as _builtin.
All native or “built-in” post types should be marked as such.

Follow up to [52041].

See #54336.
Built from https://develop.svn.wordpress.org/trunk@52108


git-svn-id: http://core.svn.wordpress.org/trunk@51700 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-10 14:01:59 +00:00
desrosj
a64530a976 Posts, Post Types: Remove gutenberg text domain from post type strings.
Introduced in [52041], and [52069].

See #54336, #54337.
Built from https://develop.svn.wordpress.org/trunk@52106


git-svn-id: http://core.svn.wordpress.org/trunk@51698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-10 13:46:00 +00:00
TimothyBlynJacobs
e2d4385a4f REST API: Introduce Menu management endpoints.
This commit introduces the `/wp/v2/menus`, `/wp/v2/menu-items` and `/wp/v2/menu-locations` REST API endpoints. These endpoints are fully available to users with the `edit_theme_options` capability, but can be read by any user who can edit a REST API available post type.

The `nav_menu` taxonomy and `nav_menu_item` post type now map their capabilities to the `edit_theme_options` primitive capability. This allows developers to provide more fine-grained access control. However, if a developer is currently dynamically removing the `edit_theme_options` capability using `map_meta_cap`, they should use the `user_has_cap` filter instead.

The `wp_update_nav_menu_item()` function has been adjusted to return an error if saving the menu item post or assigning the menu item to a menu generate an error.

Lastly, a new menu item type is introduced, `block`, that can be used to store a Block as a menu item.

Props andraganescu, antonvlasenko, dingo_d, dlh, isabel_brison, kadamwhite, Mamaduka, NateWr, noisysocks, peterwilsoncc, ryelle, schlessera, soean, Spacedmonkey, talldanwp, TimothyBlynJacobs, tobifjellner, westonruter, wpscholar, zieladam.
Fixes #40878.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-09 19:00:01 +00:00
noisysocks
c421e9b34a Add Site Editor and PHP changes from Gutenberg 10.1 - 11.9
- First pass at adding the site editor from the Gutenberg plugin to
  wp-admin/site-editor.php.
- Adds miscellaneous PHP changes from Gutenberg 10.1 - 11.9.

Follows [52042].
See #54337.
Props youknowriad, aristath, hellofromtonya, gziolo.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-09 02:17:17 +00:00
hellofromTonya
5c47273f06 Posts, Post Types: Add $old_status parameter to {$new_status}_{$post->post_type} action.
Follow-up to [5797], [28106], [31461].

Props aaroncampbell, audrasjb, desrosj, johnbillion, sebastianpisula, swissspidy.
Fixes #36180.
Built from https://develop.svn.wordpress.org/trunk@52067


git-svn-id: http://core.svn.wordpress.org/trunk@51659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-09 01:30:58 +00:00
noisysocks
f05f235042 Editor: Add block theme infrastructure
Adds the required infrastructure to render block-based themes. This is sourced
from the Gutenberg plugin.

Fixes #54335.
Props bernhard-reiter, youknowriad, ntsekouras, hellofromtonya.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 23:10:59 +00:00
hellofromTonya
4ba2fd6f0e Posts/Post Types: Improves the 'is_post_type_viewable' filter boolean return.
As a follow-up to [52024], simplifies the strict boolean type check to conserve memory and processing. Also includes an explanation of why a strict boolean is required as the returned filtered value. This commit is consistent with the implementation in [52043].

Follow-up to [33666], [36402], [52024].

Props hellofromTonya, peterwilsoncc, cybr, jrf.
Fixes #49628.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 15:34:59 +00:00
hellofromTonya
cc39667fc1 Posts/Post Types: Introduce 'is_post_status_viewable ' filter in is_post_status_viewable().
Introduces a new filter 'is_post_status_viewable' which allows overriding the check.

The function's return signature is a boolean type. This commit ensures
the return signature remains unchanged by requirinng a strict boolean
type of the returned filtered value.

Why?
* To maintain this signature and backwards-compatibility.
* To future prepare for PHP 8.1 and beyond.

An explanation is included in the filter's DocBlock.

Follow-up to [50130].

Props audrasjb, hellofromTonya, peterwilsoncc.
Fixes #54375.
Built from https://develop.svn.wordpress.org/trunk@52043


git-svn-id: http://core.svn.wordpress.org/trunk@51635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 15:21:59 +00:00
jorgefilipecosta
0b4ecc9b23 Add: wp_global_styles custom post type.
This commit adds the wp_global_styles custom post type following the same approach used to add other core custom post types. It also updates the wp_theme taxonomy to include the wp_global_styles post type.
The post type is registered in the same way it is on the plugin we just adapt the location for the core.

See #54336.
Props oandregal.
Built from https://develop.svn.wordpress.org/trunk@52041


git-svn-id: http://core.svn.wordpress.org/trunk@51633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 14:26:00 +00:00
hellofromTonya
862f6e9569 Posts/Post Types: Add filter to is_post_type_viewable().
Introduces a new filter `'is_post_type_viewable'` which allows overriding the check. The expected filtered value is a boolean. As filtered values can change, including the data type, this commit includes a `is_bool()` check, thus ensuring backwards-compatibility.

Follow-up to [33666], [36402].

Props audrasjb, deepaklalwani, hellofromTonya, peterwilsoncc, powerbuoy, sergeybiryukov.
Fixes #49628.
Built from https://develop.svn.wordpress.org/trunk@52024


git-svn-id: http://core.svn.wordpress.org/trunk@51616 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-05 23:01:58 +00:00
Peter Wilson
cae71f232c Comments: Avoid reparenting during post deletion.
Delete comments in a descending order by comment ID when deleting a post.

This avoids the expense of additional database queries required to re-parent threaded comments that are themselves about to be deleted.

Props Mte90, andraganescu, johnbillion, hellofromTonya, peterwilsoncc.
Fixes #37703.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51606 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-04 23:56:58 +00:00
Sergey Biryukov
b855ffec3f Docs: Add a @since note for the rest_namespace argument of register_post_type() and register_taxonomy().
Use 3-digit, x.x.x-style semantic versioning for `@since` tags of the `$rest_namespace` property in `WP_Post_Type` and `WP_Taxonomy`.

Add a `@since` note to `WP_REST_Taxonomies_Controller::get_item_schema()` for the `visibility` and `rest_namespace` properties.

The `rest_base` property was also added after the method was initially introduced, but that happened during the same release cycle, so it doesn't need a separate `@since` note.

Follow-up to [38832], [39191], [42729], [51959], [51961], [51962], [51964].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51965


git-svn-id: http://core.svn.wordpress.org/trunk@51554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-01 14:31:00 +00:00
TimothyBlynJacobs
bac6e41c85 REST API: Support custom namespaces for custom post types.
While a custom post type can define a custom route by using the `rest_base` argument, a namespace of `wp/v2` was assumed. This commit introduces support for a `rest_namespace` argument. 

A new `rest_get_route_for_post_type_items` function has been introduced and the `rest_get_route_for_post` function updated to facilitate getting the correct route for custom post types.

While the WordPress Core Block Editor bootstrap code has been updated to use these API functions, for maximum compatibility sticking with the default `wp/v2` namespace is recommended until the API functions see wider use.

Props spacedmonkey, swissspidy.
Fixes #53656.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51551 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-31 23:16:58 +00:00
Sergey Biryukov
8447683474 Docs: Improve documentation for the tax_input parameter of wp_insert_post().
Follow-up to [10222], [13217], [33922].

Props dingo_d.
Fixes #54264.
Built from https://develop.svn.wordpress.org/trunk@51913


git-svn-id: http://core.svn.wordpress.org/trunk@51506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-16 02:38:58 +00:00
hellofromTonya
4a1cc2c3e2 FileSystem API: Add safeguard for invalid return from get_attached_file() in wp_delete_attachment().
The `get_attached_file()` function is supposed to return the path to the file, but could:
1. Return `false` if the file doesn't exist.
2. Return literally anything else, as a filter is being applied to the value on return.

As the `clean_dirsize_cache()` now has input validation, passing anything but a non-empty string to `clean_dirsize_cache()` will result in a PHP error notice.

This was exposed by the `Tests_Post_GetPostStatus::wpSetUpBeforeClass()` method which started generating unexpected output (the doing it wrong message) during the test run.

While this indicates that there is a flaw in the mocking being done in the test suite, debugging that is outside of the scope of the current patch.

At the same time, as based on the above point, this ''could'' potentially happen in a real-world situation as well, adding additional conditions to the `if` in the `wp_delete_attachment()` function before calling the `clean_dirsize_cache()` function, is warranted.

As there are no tests for the `wp_delete_attachment()` function at all at this time, we're not adding a test specifically for this change for now. This should however be addressed in the future, when tests will be added to cover the `wp_delete_attachment()` function completely. 

Follow-up to [32619], [49212], [51910].

Props jrf, hellofromTonya.
See #52241.
Built from https://develop.svn.wordpress.org/trunk@51912


git-svn-id: http://core.svn.wordpress.org/trunk@51505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-15 22:58:56 +00:00
Sergey Biryukov
1020306fe9 I18N: Add context for some Media Library filter strings:
* Audio
* Video
* Unattached

This allows for more homogeneous translations in languages where keeping a plural form is important.

Follow-up to [6910], [7397], [8901], [9556], [11749], [13100], [12110], [15491], [15578], [22743], [29426], [29625], [34256], [45651], [46437].

Props jdy68, audrasjb, SergeyBiryukov.
Fixes #54238.
Built from https://develop.svn.wordpress.org/trunk@51903


git-svn-id: http://core.svn.wordpress.org/trunk@51496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-12 16:44:01 +00:00
John Blackbourn
41995176f6 Docs: Miscellaneous inline documentation improvements, including:
* Document the post statuses global as an array of `stdClass` objects
* Document the taxonomies global as an array of `WP_Taxonomy` objects
* Document the return value of the post count functions as `stdClass` objects
* Fix some typos

See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-04 20:44:02 +00:00
John Blackbourn
07f3c35467 General: Fix code quality issues which were identified by static analysis.
This fixes minor issues that could cause PHP notices under the right conditions, and fixes some general incorrectness.

Props jrf, hellofromTonya for review

See #52217

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


git-svn-id: http://core.svn.wordpress.org/trunk@51449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-22 21:01:00 +00:00
John Blackbourn
ae9eae8f64 Docs: Document some more common names for dynamic hooks and standardise the phrasing used.
Fixes #53581

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


git-svn-id: http://core.svn.wordpress.org/trunk@51444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-21 18:21:00 +00:00
Sergey Biryukov
a727138559 Docs: Synchronize the $post_id argument description for some post and attachment functions.
See #53399.
Built from https://develop.svn.wordpress.org/trunk@51430


git-svn-id: http://core.svn.wordpress.org/trunk@51041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-14 08:14:01 +00:00
Sergey Biryukov
10f7a91fa7 Docs: Correct documentation for wp_get_post_parent_id().
The `$post` parameter is required and does not have a default value.

Follow-up to [42397].

Props denisco.
See #53399.
Built from https://develop.svn.wordpress.org/trunk@51425


git-svn-id: http://core.svn.wordpress.org/trunk@51036 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-13 18:34:57 +00:00
John Blackbourn
efaf4a8938 Docs: Add and correct examples of common names for various dynamic hooks.
See #53581

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


git-svn-id: http://core.svn.wordpress.org/trunk@50936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-03 21:42:59 +00:00
John Blackbourn
e4cfebe92e Docs: Undo the accidental revert of [51299] made in [51300].
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:29:56 +00:00
John Blackbourn
ea60cd8191 Docs: Descriptive improvements and corrections for various docblocks.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:12:58 +00:00
John Blackbourn
9146628ae1 Docs: Miscellaneous formatting corrections for docblocks.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:10:56 +00:00
John Blackbourn
79685db062 Docs: Corrections and improvements to types used in docblocks for symbols, properties, and filters.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:02:57 +00:00
Sergey Biryukov
9c0dc03f90 Posts, Post Types: Speed cached get_pages() calls.
This improves performance for sites with persistent cache backend having a lot of pages requested via the `get_pages() function, by taking advantage of `wp_cache_get_multiple()` instead of fetching each individual page from the backend cache server one by one.

It also matches the behaviour of `get_pages()` when the pages are retrieved from the database.

Props david.binda, hellofromTonya.
Fixes #51469.
Built from https://develop.svn.wordpress.org/trunk@51018


git-svn-id: http://core.svn.wordpress.org/trunk@50627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 23:41:57 +00:00
Sergey Biryukov
b8ee0a22a5 Posts, Post Types: Remove some unused strings from built-in post type declarations.
The `customize_changeset`, `wp_block`, and `wp_template` post types are not displayed in the admin menu or in the admin bar.

If they do get added, the labels can just fall back to `name` and `singular_name` until separate strings are required for more flexible translations.

Follow-up to [38810], [44146], [51003].

See #53176.
Built from https://develop.svn.wordpress.org/trunk@51015


git-svn-id: http://core.svn.wordpress.org/trunk@50624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 22:49:57 +00:00
Sergey Biryukov
74eec0c180 Block Editor: Declare the wp_template post type as built-in.
Remove redundant `show_in_admin_bar` property, which defaults to the value of `show_in_menu`.

Follow-up to [51003].

See #53176.
Built from https://develop.svn.wordpress.org/trunk@51014


git-svn-id: http://core.svn.wordpress.org/trunk@50623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 22:29:05 +00:00
youknowriad
4ae0e4220f Block Editor: Introduce block templates for classic themes.
With this patch, users will be able to create custom block based templates
and assign them to specific pages/posts.

Themes can also opt-out of this feature

Props bernhard-reiter, carlomanf.
Fixes #53176.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 14:20:57 +00:00
Sergey Biryukov
893beee31e General: Ensure consistent type for integer properties of WP_Post, WP_Term, and WP_User.
Previously, these properties could be unexpectedly converted to strings in some contexts.

This applies to the following functions:

* `sanitize_post_field()`
* `sanitize_term_field()`
* `sanitize_user_field()`

and the following properties:

* `WP_Post::ID`
* `WP_Post::post_parent`
* `WP_Post::menu_order`
* `WP_Term::term_id`
* `WP_Term::term_taxonomy_id`
* `WP_Term::parent`
* `WP_Term::count`
* `WP_Term::term_group`
* `WP_User::ID`

Props grantmkin, SergeyBiryukov.
Fixes #53235. See #52995.
Built from https://develop.svn.wordpress.org/trunk@50935


git-svn-id: http://core.svn.wordpress.org/trunk@50544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-19 22:11:56 +00:00
desrosj
9ec439903d Posts, Post Types: Enable revisions for the wp_block post type.
This allows site owners to take advantage of revisions while broader improvements to block management and reusable blocks are explored.

Props matveb, audrasjb, desrosj.
Fixes #53072.
Built from https://develop.svn.wordpress.org/trunk@50835


git-svn-id: http://core.svn.wordpress.org/trunk@50444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-10 18:38:59 +00:00
Adam Silverstein
524030edfa Images: enable WebP support.
Add support for uploading, editing and saving WebP images when supported by the server.

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

Props markoheijne, blobfolio, Clorith, joemcgill, atjn, desrosj, spacedmonkey, marylauc, mikeschroder, hellofromtonya, flixos90.
Fixes #35725.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-04 14:44:58 +00:00
gziolo
ad48a15387 Editor: Update WordPress packages to use with WordPress 5.8
In the response to the discussion during the Dev Chat, I'm doing a first pass to keep WordPress packages up to date in the WordPress 5.8 release cycle.

See https://github.com/WordPress/wordpress-develop/pull/1176 for more details.

Props youknowriad, aristath, andraganescu.
See #52991.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-15 15:19:43 +00:00
davidbaumwald
133c4e2e50 Docs: Clarify return results for a non-existing ID in metadata functions.
[48658] documented that various metadata functions return false for an invalid ID. However, that does not clarify what an invalid ID is: a non-numeric, zero, or negative value. This change adds the clarification in all relevant metadata function docblocks.

Props icopydoc, SergeyBiryukov, davidkryzaniak, audrasjb.
Fixes #51797.
Built from https://develop.svn.wordpress.org/trunk@50641


git-svn-id: http://core.svn.wordpress.org/trunk@50253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-02 15:49:05 +00:00
Sergey Biryukov
4d1595b6d4 Docs: Document the import_id parameter of wp_insert_post().
Follow-up to [9100].

Props donmhico.
Fixes #52943.
Built from https://develop.svn.wordpress.org/trunk@50621


git-svn-id: http://core.svn.wordpress.org/trunk@50234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-31 13:05:06 +00:00
Sergey Biryukov
5e10227d76 Coding Standards: Use strict comparison for return type checks in a few functions:
* `get_bookmark()`
* `get_comment()`
* `get_post()`
* `get_children()`
* `wp_get_recent_posts()`
* `wp_get_post_revision()`
* `wp_get_nav_menu_items()`

Follow-up to [45710] for `get_term()`, [48507] for `wpdb::get_row()` and `wpdb::get_results()`.

See #52627.
Built from https://develop.svn.wordpress.org/trunk@50558


git-svn-id: http://core.svn.wordpress.org/trunk@50171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-21 12:41:04 +00:00
Sergey Biryukov
6ad5c0c553 Docs: Correct formatting for the description of some register_post_type() parameters.
Props audrasjb.
Fixes #52836.
Built from https://develop.svn.wordpress.org/trunk@50538


git-svn-id: http://core.svn.wordpress.org/trunk@50151 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-17 17:33:10 +00:00
Sergey Biryukov
cb55990e50 Docs: Add missing @since tags for item_link and item_link_description post type and taxonomy labels.
Follow-up to [50527].

See #52688.
Built from https://develop.svn.wordpress.org/trunk@50529


git-svn-id: http://core.svn.wordpress.org/trunk@50142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-13 10:25:06 +00:00
gziolo
f27c179afc Editor: Make block type aware of variations
Currently block variations are only defined on the client. In some cases, creating block variations on the server can be very useful, especially when needed data is not exposed in the REST APIs.

Related to https://github.com/WordPress/gutenberg/pull/29095.

Props: gwwar, timothyblynjacobs.
Fixes: #52688.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50140 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-12 13:35:09 +00:00
John Blackbourn
52679edbff Docs: Add examples of possible names for various hooks whose name contains a dynamic portion.
This provides greater discoverability of such hooks in search results on the Code Reference site as well as increased clarity when reading the source.

See #50734, #52628

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


git-svn-id: http://core.svn.wordpress.org/trunk@50118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-07 12:32:09 +00:00
Sergey Biryukov
c6c1ef3c32 Media: Explicitly declare the $pagenow global in wp_get_attachment_url().
This avoids an "Undefined index" PHP notice in the function when running the `media` test group separately.

Follow-up to [32342], [50156], [50164], [50393].

Props johnbillion.
Fixes #52606.
Built from https://develop.svn.wordpress.org/trunk@50406


git-svn-id: http://core.svn.wordpress.org/trunk@50017 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-22 18:55:07 +00:00
Peter Wilson
23ca4ed304 Posts/Post Types: Prevent duplicates in sticky posts option.
In `unstick_post()` if a post ID is duplicated in the `sticky_posts` option remove all instances.

In both `stick_post()` and `unstick_post()` check for duplicate IDs already stored in the `sticky_post` option and remove them if the option is updated.

Props rahmohn, archon810.
Fixes #52007.

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


git-svn-id: http://core.svn.wordpress.org/trunk@49991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-17 22:58:05 +00:00
John Blackbourn
ea252a7cba Posts, Post Types: Clarify the documentation about the return value of get_post() when a falsey value is passed.
Props Rahe, juliobox, peterwilsoncc, hellofromTonya, audrasjb

Fixes #33068

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


git-svn-id: http://core.svn.wordpress.org/trunk@49911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-09 13:44:04 +00:00
Peter Wilson
71b277da38 Posts/Post Types: Improve documentation of get_posts().
Add references to `WP_Query` to the documentation of `get_posts()`. As the developer documentation for `WP_Query` includes an expanded explanation a full link to developer.wordpress.org is included rather than a standard `@see`.

Props dam6pl, peterwilsoncc.
See #51852, #51800.


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


git-svn-id: http://core.svn.wordpress.org/trunk@49902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-08 22:52:02 +00:00
Peter Wilson
17ee62881a Posts, Post Types: Additional functions to check if a post is publicly viewable.
Introduces `is_post_status_viewable()` as a sibling to `is_post_type_viewable()`. Internal and protected statuses are never considered viewable. For built in posts statuses the `public` attribute is checked, for custom statuses the `publicly_queryable` attribute is checked.

Introduces `is_post_publicly_viewable()` for determining if an individual post can be viewed by logged out users. A post is considered viewable if both `is_post_status_viewable()` and `is_post_type_viewable()` return `true` for the post's attributes.

Additionally modifies `is_post_type_viewable()` to return `false` if an unregistered post type is passed to the function to avoid attempting to access properties on a non-object.

Props peterwilsoncc, SergeyBiryukov, whyisjake, TimothyBlynJacobs.
Fixes #49380.


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


git-svn-id: http://core.svn.wordpress.org/trunk@49809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-01 23:33:02 +00:00
Sergey Biryukov
81462ca73e Posts, Post Types: Introduce "Filter by date" and "Filter by category" as post type and taxonomy labels, respectively.
This provides a more consistent location for these strings and allows for reusing them in other places without hardcoding them in the markup.

Props nicolalaserra, audrasjb, johnjamesjacoby, SergeyBiryukov.
Fixes #42421.
Built from https://develop.svn.wordpress.org/trunk@50120


git-svn-id: http://core.svn.wordpress.org/trunk@49799 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-01 14:13:00 +00:00
Sergey Biryukov
2ca69453bd Docs: Revert documentation change for wp_get_attachment_metadata().
This more accurately describes the behavior of the function, and is more consistent with the documentation for other post and attachment functions.

Follow-up to [50039].

Props Mista-Flo.
See #52196.
Built from https://develop.svn.wordpress.org/trunk@50051


git-svn-id: http://core.svn.wordpress.org/trunk@49752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-28 10:42:01 +00:00
whyisjake
3beabe0b11 Media: Ensure that wp_get_attachment_metadata can return values from the global $post, if avaiable.
In [49084] (for #50679), wp_get_attachment_metadata() was changed to improve performance, but it had the side effect of eliminating the ability to call it with no arguments and have it default to using the global $post.

This change restores that ability, while keeping the performance improvements from the original change.

Fixes #52196.

Props cfinke, hellofromTonya, mukesh27, dilipbheda, Mista-Flo, audrasjb, SergeyBiryukov, whyisjake.


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


git-svn-id: http://core.svn.wordpress.org/trunk@49740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-28 00:08:58 +00:00
Gary Pendergast
ce19f7a630 Posts: Create a new function for resolving the post date.
`wp_insert_post()` has a few checks using `post_date` and `post_date_gmt`, to determine the correct post date. This functionality is now extracted out into a new `wp_resolve_post_date()` function, allowing the checks to be reused elsewhere.

Props jmdodd.
Fixes #52187.


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


git-svn-id: http://core.svn.wordpress.org/trunk@49713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-25 01:07:59 +00:00
Peter Wilson
ce5a508734 Media: Ensure get_post_status() does not contain half a comment.
Removes a misplaced comment, follow up to [49985].

Props SergeyBiryukov.
Fixes #52326.


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


git-svn-id: http://core.svn.wordpress.org/trunk@49687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-20 05:00:01 +00:00
Peter Wilson
9c2c78b6c8 Media: Ensure get_post_status() returns correct result for attachments.
Prevent `get_post_status()` returning `false` for attachments if the parent post has been deleted. The returned attachment post status is now passed through the `get_post_status` filter.

Add tests for `get_post_status()`.

Props peterwilsoncc, timothyblynjacobs for review.
Fixes #52326.


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


git-svn-id: http://core.svn.wordpress.org/trunk@49686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-20 04:41:03 +00:00
Sergey Biryukov
ba0906799c Coding Standards: Fix WPCS issue in [49963].
Props pawki07, mukesh27.
Fixes #52316. See #51800.
Built from https://develop.svn.wordpress.org/trunk@49965


git-svn-id: http://core.svn.wordpress.org/trunk@49666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-16 17:20:12 +00:00
Sergey Biryukov
5c663524c2 Docs: In various @return tags, list the expected type first, instead of false.
Follow-up to [46696], [47060], [49926], [49927], [49929].

See #51800.
Built from https://develop.svn.wordpress.org/trunk@49963


git-svn-id: http://core.svn.wordpress.org/trunk@49664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-15 20:08:07 +00:00
John Blackbourn
b59c0f307b Docs: Corrections and improvements to types used in various docblocks.
See #51800, #52217

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


git-svn-id: http://core.svn.wordpress.org/trunk@49635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-05 17:16:11 +00:00
Sergey Biryukov
37662df05e Docs: In various @return tags, list the expected type first, instead of false or WP_Error.
Follow-up to [46696], [47060], [49926], [49927].

See #51800.
Built from https://develop.svn.wordpress.org/trunk@49929


git-svn-id: http://core.svn.wordpress.org/trunk@49628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-04 17:18:04 +00:00
John Blackbourn
dfe1f9b322 Docs: Promote many bool types to true or false where only that value is used.
See #51800

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


git-svn-id: http://core.svn.wordpress.org/trunk@49626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-03 22:04:04 +00:00
John Blackbourn
53da9208dd Docs: Various docblock corrections particularly relating to boolean types.
See #51800

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


git-svn-id: http://core.svn.wordpress.org/trunk@49625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-03 21:57:09 +00:00
Sergey Biryukov
5a7fa8b7f3 Posts, Post Types: Correct the check for term IDs to be queued for lazy-loading term meta.
This ensures that the `$term_ids` array in `wp_queue_posts_for_term_meta_lazyload()` (an indexed array not keyed by ID) does not contain duplicate values.

Props denishua, akabarikalpesh.
Fixes #52144.
Built from https://develop.svn.wordpress.org/trunk@49905


git-svn-id: http://core.svn.wordpress.org/trunk@49604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-24 11:21:04 +00:00
John Blackbourn
bf83c368fd Docs: Various docblock improvements.
See #51800

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


git-svn-id: http://core.svn.wordpress.org/trunk@49513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-10 23:59:03 +00:00
John Blackbourn
42fcfa5b3d Docs: Various docblock corrections.
See #51800

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


git-svn-id: http://core.svn.wordpress.org/trunk@49512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-10 23:53:07 +00:00
John Blackbourn
00680f2e89 REST API: Pass the previous state of the post as a parameter to the wp_after_insert_post hook.
This enables, for example, the previous post status to be used by this hook without the need to first capture it on an earlier hook.

This also fixes the value of the `$fire_after_hooks` parameter in `get_default_post_to_edit()` so the `wp_after_insert_post` action correctly fires just once on the new post screen.

Props Collizo4sky, peterwilsoncc, hellofromTonya, TimothyBlynJacobs, SergeyBiryukov

Fixes #45114

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


git-svn-id: http://core.svn.wordpress.org/trunk@49454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-01 20:47:06 +00:00
John Blackbourn
f4cda1b62f Docs: Upgrade more parameters in docblocks to used typed array notation.
See #51800, #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@49416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-24 21:27:05 +00:00
John Blackbourn
780cdb5eb5 Docs: Various docblock corrections relating to parameter types.
See #51800

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


git-svn-id: http://core.svn.wordpress.org/trunk@49415 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-24 21:22:04 +00:00
Sergey Biryukov
d86f6bde55 Docs: Correct $fire_after_hooks parameter name in @since tags.
Follow-up to [49172], [49173].

See #45114.
Built from https://develop.svn.wordpress.org/trunk@49673


git-svn-id: http://core.svn.wordpress.org/trunk@49396 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-20 11:58:06 +00:00
John Blackbourn
35f6c356c1 Docs: Document parameters that accept an array of integers using typed array notation.
While many of these parameters also technically accept an array of numerical strings, they are all ultimately cast to an array of integers. Documenting them as such assists developers in understanding the expected types.

See #51800, #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@49395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-19 18:24:09 +00:00
Helen Hou-Sandí
aceaf33edd Multisite: More consistency for clean_dirsize_cache().
Props SergeyBiryukov.
Fixes #19879.

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


git-svn-id: http://core.svn.wordpress.org/trunk@49354 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-16 22:31:06 +00:00
Sergey Biryukov
ec051cfb3e Docs: Clarify that get_pages() returns an array of pages, not an HTML list.
Props ben.meredith@gmail.com, ovenall, johannadevos.
Fixes #39049. See #51768.
Built from https://develop.svn.wordpress.org/trunk@49595


git-svn-id: http://core.svn.wordpress.org/trunk@49333 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-14 15:01:13 +00:00
John Blackbourn
34765ddb64 Docs: Docblock corrections relating to WP_Post objects.
See #51373, #50768

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


git-svn-id: http://core.svn.wordpress.org/trunk@49282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-09 15:15:08 +00:00
Sergey Biryukov
87cdca8cd6 Docs: Change the @since entry for template and template_lock post type arguments to 5.0.0.
These arguments were introduced with the initial block editor, but not documented previously.

Follow-up to [49495].

Props TimothyBlynJacobs.
See #46261.
Built from https://develop.svn.wordpress.org/trunk@49496


git-svn-id: http://core.svn.wordpress.org/trunk@49255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-04 02:47:05 +00:00
Sergey Biryukov
096323d8a5 Docs: Add documentation for the template_lock argument to register_post_type().
Add a `@since` entry for `template` and `template_lock` arguments.

Follow-up to [49041], [49492], [49494].

See #46261.
Built from https://develop.svn.wordpress.org/trunk@49495


git-svn-id: http://core.svn.wordpress.org/trunk@49254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-04 02:32:08 +00:00
Sergey Biryukov
618fb979c6 Docs: Add a reference to wp_insert_post() for information on the arguments accepted by wp_update_post().
See #50768.
Built from https://develop.svn.wordpress.org/trunk@49493


git-svn-id: http://core.svn.wordpress.org/trunk@49252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-04 01:39:06 +00:00
Peter Wilson
c8d5bc3c50 Taxonomy: Revert Light-weight/partial term counts.
Partial revert of [49141], [49171], [49316].

All functional changes are removed, appropriate term counting unit tests are retained.

See #40351.

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


git-svn-id: http://core.svn.wordpress.org/trunk@49210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-30 04:59:08 +00:00
Sergey Biryukov
72cff29cb6 Posts, Post Types: Check if taxonomy is set for the tax_input parameter of wp_insert_post().
This avoids a PHP notice when creating a post with multiple taxonomies both having a default term.

Props yakimun, szaqal21, hareesh-pillai, audrasjb.
Fixes #51320.
Built from https://develop.svn.wordpress.org/trunk@49328


git-svn-id: http://core.svn.wordpress.org/trunk@49089 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-27 16:42:05 +00:00
Sergey Biryukov
919f1cf461 Docs: Fix typo in {$old_status}_to_{$new_status} hook description.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@49326


git-svn-id: http://core.svn.wordpress.org/trunk@49087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-27 15:42:09 +00:00
Helen Hou-Sandí
bdfd1a954f Multisite: More specific caching for get_dirsize.
Instead of one cache entry for all upload folders for a site on multisite, this now caches for each folder and invalidates that cache based on context. In multisite, this should speed up `get_dirsize` calls since older directories that are much less likely to change will no longer have the size recalculated.

Props janthiel, A5hleyRich, batmoo.
Fixes #19879.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-19 21:51:06 +00:00
Sergey Biryukov
0e3147c40e Coding Standards: Replace alias PHP functions with the canonical names.
Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.

This replaces all uses of the following:
* `join()` with `implode()`
* `sizeof()` with `count()`
* `is_writeable()` with `is_writable()`
* `doubleval()` with a `(float)` cast

In part, this is a follow-up to #47746.

Props jrf.
See #50767.
Built from https://develop.svn.wordpress.org/trunk@49193


git-svn-id: http://core.svn.wordpress.org/trunk@48955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-18 17:27:06 +00:00
Sergey Biryukov
6c13cdd533 Docs: Add @since tags for the fire_after_hooks parameter of wp_insert_post(), wp_update_post(), and wp_insert_attachment().
Document the parameter as optional.

Follow-up to [49172].

See #45114.
Built from https://develop.svn.wordpress.org/trunk@49173


git-svn-id: http://core.svn.wordpress.org/trunk@48935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-16 09:40:10 +00:00
Peter Wilson
32d193f96f REST API, Posts: Add a hook to fire once a post, its terms and meta update.
Introduces the action `wp_after_insert_post` inside a wrapper function of the same name. This hook allows plugin developers to access a posts full data (including its terms and meta data) regardless of the workflow used to save it.

A new parameter is introduced to `wp_insert_post()` to indicate whether the hook should be fired within the function call or will be fired afterward.

Props aristath, Collizo4sky, danielbachhuber, joyously, kadamwhite, kraftbj, markparnell, mikeschroder, noisysocks, peterwilsoncc, SergeyBiryukov, talldanwp, thewebprincess, TimothyBlynJacobs.
Fixes #45114.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-16 03:34:08 +00:00
Peter Wilson
fa5a6c8622 Taxonomy: Improve performance of term recounting database queries.
When modifying terms assigned to an object, replace full term recounts with incrementing/decrementing the count as appropriate. This provides a significant performance boost on sites with a high number of term/object relationships and/or posts.

Introduces the functions `wp_increment_term_count()`, `wp_decrement_term_count()`, `wp_modify_term_count_by()` and `wp_modify_term_count_by_now()` for updating the term count.

Introduces the function `_wp_prevent_term_counting()` for preventing double counting on posts that are about to transition.

Adds the parameter `update_count_by_callback` to `register_taxonomy()` to allow developers to use a custom callback for incrementing or decrementing a term count.

Props boonebgorges, davidbaumwald, hellofromTonya, johnbillion, lcyh78, mattoperry, peterwilsoncc, rebasaurus, whyisjake.
Fixes #40351.


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


git-svn-id: http://core.svn.wordpress.org/trunk@48903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-14 00:51:06 +00:00
John Blackbourn
bd1fa2d998 Posts, Post Types: Switch to restoring posts to draft status by default when they are untrashed.
This allows for edits to be made to a restored post before it goes live again. This also prevents scheduled posts being published unexpectedly if they are untrashed after their originally scheduled date.

The old behaviour of restoring untrashed posts to their original status can be reinstated using the `wp_untrash_post_set_previous_status()` helper function.

Also fixes an issue where the incorrect post ID gets passed to hooks if no post ID is passed to the function.

Props harrym, bananastalktome, jaredcobb, chriscct7, melchoyce, johnbillion, pankajmohale

Fixes #23022

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


git-svn-id: http://core.svn.wordpress.org/trunk@48887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-11 13:39:07 +00:00
Sergey Biryukov
897f004a9c General: Replace older-style PHP type conversion functions with type casts.
This improves performance, readability, and consistency throughout core.

* `intval()` → `(int)`
* `strval()` → `(string)`
* `floatval()` → `(float)`

Props ayeshrajans.
Fixes #42918.
Built from https://develop.svn.wordpress.org/trunk@49108


git-svn-id: http://core.svn.wordpress.org/trunk@48870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-08 21:15:13 +00:00
Sergey Biryukov
f880f14080 Coding Standards: Make checks for an empty post in wp-includes/post.php more consistent.
See #50767.
Built from https://develop.svn.wordpress.org/trunk@49086


git-svn-id: http://core.svn.wordpress.org/trunk@48848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-02 12:37:06 +00:00
Helen Hou-Sandí
b108d4db71 Media: Don't unnecessarily check for a valid attachment before getting meta.
This makes `wp_get_attachment_metadata()` run significantly faster. See ticket for benchmarking.

Props Tkama, donmhico.
Fixes #50679.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-01 17:55:06 +00:00
noisysocks
8fa8aad136 Documentation: Add 'template' arg documentation
Add inline documentation for the 'template' arg accepted by
register_post_type().

Props milana_cap.
See #46261.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-24 03:12:04 +00:00
Peter Wilson
b1505c2d9c Posts, Post Types: Ensure default terms are added by wp_publish_post().
Transitioning posts from `auto-draft` to `publish` via `wp_publish_post()` could result in published posts without the default category or custom taxonomy default terms.

Props frank-klein, TimothyBlynJacobs, peterwilsoncc.
Fixes #51292.


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


git-svn-id: http://core.svn.wordpress.org/trunk@48762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-19 01:22:08 +00:00
Sergey Biryukov
042bdf66fd Docs: Document the usage of $wpdb global in wp_delete_attachment_files().
Props jontyravi.
Fixes #51309.
Built from https://develop.svn.wordpress.org/trunk@48976


git-svn-id: http://core.svn.wordpress.org/trunk@48738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-14 13:43:04 +00:00
John Blackbourn
d0a32c5111 Docs: Various docblock corrections and improvements.
See #50768
Built from https://develop.svn.wordpress.org/trunk@48941


git-svn-id: http://core.svn.wordpress.org/trunk@48703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-04 20:41:07 +00:00
desrosj
4ad0086a2a Editor: Update the post type labels for the reusable blocks post type.
Previously, the labels for the reusable block post type were just “block”. The document settings tab in the block editor has been changed to use the post type label specified instead to be more specific. Changing the reusable block post type labels to “reusable block” prevents two “Block” tabs from showing in the editor.

Props desaiuditd, peterwilsoncc.
Fixes #50755.
Built from https://develop.svn.wordpress.org/trunk@48829


git-svn-id: http://core.svn.wordpress.org/trunk@48591 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-19 13:40:12 +00:00
Sergey Biryukov
1f85e7484f Docs: Consistently use third-person singular verbs for various filter descriptions, per the documentation standards.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@48782


git-svn-id: http://core.svn.wordpress.org/trunk@48544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-11 00:34:08 +00:00
Sergey Biryukov
3da046e1bc Taxonomy: Rename the default_taxonomy_$taxonomy option key to default_term_$taxonomy.
This better reflects the purpose of the option.

Follow-up to [48356], [48480].

See #43517.
Built from https://develop.svn.wordpress.org/trunk@48665


git-svn-id: http://core.svn.wordpress.org/trunk@48427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-28 15:42:07 +00:00
Sergey Biryukov
38e6367808 Coding Standards: Reformat a condifion for default taxonomy terms in map_meta_cap() for better readability.
Follow-up to [48356], [48480].

See #43517.
Built from https://develop.svn.wordpress.org/trunk@48664


git-svn-id: http://core.svn.wordpress.org/trunk@48426 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-28 14:42:04 +00:00
Sergey Biryukov
5f6d6a79e8 Docs: Document that various metadata functions return false for an invalid ID.
Props salcode.
See #40519.
Built from https://develop.svn.wordpress.org/trunk@48658


git-svn-id: http://core.svn.wordpress.org/trunk@48420 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-28 10:15:04 +00:00
Sergey Biryukov
d0be6f61f9 Posts, Post Types: Pass correct variable to the get_lastpostdate filter.
Follow-up to [48634].

See #49572.
Built from https://develop.svn.wordpress.org/trunk@48635


git-svn-id: http://core.svn.wordpress.org/trunk@48397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-27 11:38:04 +00:00
Sergey Biryukov
710da7e441 Docs: Synchronize documentation for get_lastpostdate() and get_lastpostmodified().
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48634


git-svn-id: http://core.svn.wordpress.org/trunk@48396 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-27 11:18:12 +00:00
Sergey Biryukov
4c0a764adc Posts, Post Types: Pass the post type to get_lastpostdate() in get_lastpostmodified().
This ensures that the correct values are being compared when retrieving the result for custom post types.

Additionally, pass the `$post_type` parameter to `get_lastpostdate` and `get_lastpostmodified` filters.

Props mikaumoto, munyagu, donmhico, johnbillion, SergeyBiryukov.
Fixes #47777.
Built from https://develop.svn.wordpress.org/trunk@48631


git-svn-id: http://core.svn.wordpress.org/trunk@48393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-27 02:18:05 +00:00
Sergey Biryukov
d8c62b5647 Posts, Post Types: Move get_post_states() back to the admin for now, require the file in WP_Customize_Nav_Menus::customize_register() instead.
This provides a minor performance improvement by only running the function in contexts where it's needed.

Follow-up to [47211], [47213], [47763], [48619].

See #46829, #49374.
Built from https://develop.svn.wordpress.org/trunk@48620


git-svn-id: http://core.svn.wordpress.org/trunk@48382 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-26 10:51:06 +00:00
Sergey Biryukov
aab535a576 Posts, Post Types: Make get_post_states() available on frontend.
This allows special pages to be denoted as such when editing a menu in the Customizer.

This applies to the Front Page, Posts Page, and Privacy Policy Page.

Follow-up to [47211], [47213], [47763].

Props dlh, whyisjake, SergeyBiryukov.
Fixes #46829. See #49374.
Built from https://develop.svn.wordpress.org/trunk@48619


git-svn-id: http://core.svn.wordpress.org/trunk@48381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-26 01:14:06 +00:00
Sergey Biryukov
d936f2c959 Docs: Miscellaneous DocBlock corrections.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48591


git-svn-id: http://core.svn.wordpress.org/trunk@48353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 21:55:04 +00:00
John Blackbourn
9bc7d0a776 Docs: Another pass at some inline docs fixes mostly made by PHPCBF.
See #49572, #50744
Built from https://develop.svn.wordpress.org/trunk@48590


git-svn-id: http://core.svn.wordpress.org/trunk@48352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 21:11:05 +00:00