Commit Graph

1293 Commits

Author SHA1 Message Date
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
Sergey Biryukov
b8871c0323 I18N: Add context to privacy request status strings.
These strings already have a context in `create_initial_post_types()`, and should use the same context in `_wp_privacy_statuses()`.

Props ramiy, audrasjb.
Fixes #50740.
Built from https://develop.svn.wordpress.org/trunk@48578


git-svn-id: http://core.svn.wordpress.org/trunk@48340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 13:13:03 +00:00
whyisjake
4a237f2d48 Posts, Post Types: Ensure that all post stati are countable in wp_count_posts.
When `wp_count_posts()` is cached, it does so with all statuses defaulted to 0. The problem is however, if this is called before all plugins have registered their desired statuses, they won't have that default.

Fixes #49685.

Props obliviousharmony, SergeyBiryukov.


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


git-svn-id: http://core.svn.wordpress.org/trunk@48259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-16 21:44:04 +00:00
Sergey Biryukov
49a9cede70 Taxonomy: Make some adjustments to handling default terms for custom taxonomies:
* Move default term assignment from `wp_set_object_terms()` to `wp_insert_post()`.
* Make sure the passed taxonomy list overwrites the existing list if not empty.
* Remove the default term option on `unregister_taxonomy()`.
* Prevent deletion of the default term in `wp_delete_term()`.

Props enrico.sorcinelli, TimothyBlynJacobs.
See #43517.
Built from https://develop.svn.wordpress.org/trunk@48480


git-svn-id: http://core.svn.wordpress.org/trunk@48249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-14 16:41:03 +00:00
John Blackbourn
6b21db7fb9 Docs: Miscellaneous docblock corrections and improvements.
See #49572
Built from https://develop.svn.wordpress.org/trunk@48462


git-svn-id: http://core.svn.wordpress.org/trunk@48231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-13 22:10:07 +00:00
whyisjake
49d23a2bbe Taxonomy: Add support for default terms for custom taxonomies.
The new default_term argument is added to `register_taxonomy()` allowing a user to define the default term `name` and optionally `slug` and `description`. 

Fixes #43517.

Props enrico.sorcinelli, SergeyBiryukov, desrosj, davidbaumwald, whyisjake.


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


git-svn-id: http://core.svn.wordpress.org/trunk@48125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-07 00:55:03 +00:00
Sergey Biryukov
de751a91db Taxonomy: Introduce saved_term and saved_{$taxonomy} actions to complement created_term and created_{$taxonomy}.
This allows for hooking into both the create and update events with a single callback, in the same way that is already possible for posts via the `save_post` and `save_post_{$post->post_type}` actions.

Props dlh.
Fixes #48416.
Built from https://develop.svn.wordpress.org/trunk@48314


git-svn-id: http://core.svn.wordpress.org/trunk@48083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-05 11:13:03 +00:00
Sergey Biryukov
9f92384fe7 Post Thumbnails: Change the return value of get_post_thumbnail_id() for a non-existing post to false instead of an empty string.
This further makes the function more consistent with `get_the_ID()` or `wp_get_post_parent_id()`, both returning `false` for a non-existing post.

Additionally, document that `get_post_thumbnail_id()` returns `0` if the thumbnail image is not set.

Follow-up to [47160].

Props theMikeD, dingo_d, netpassprodsr, SergeyBiryukov.
Fixes #49832. See #40096.
Built from https://develop.svn.wordpress.org/trunk@48310


git-svn-id: http://core.svn.wordpress.org/trunk@48079 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-05 10:17:02 +00:00
Sergey Biryukov
347e831768 Docs: Improve documentation for the $prev_value parameter and return result of various metadata update functions.
Props stevenlinx.
Fixes #50502. See #49572.
Built from https://develop.svn.wordpress.org/trunk@48214


git-svn-id: http://core.svn.wordpress.org/trunk@47983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-29 21:22:09 +00:00
Sergey Biryukov
37dea23ce8 Docs: Document the return value of wp_get_attachment_metadata() using hash notation.
Props stevenlinx.
Fixes #50505.
Built from https://develop.svn.wordpress.org/trunk@48212


git-svn-id: http://core.svn.wordpress.org/trunk@47981 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-29 11:20:08 +00:00
Sergey Biryukov
40c389c95e Docs: Standardize on "Returning a value from the filter" vs. "Passing a value to the filter".
The filter is the callback function added with `add_filter()`, therefore the hook passes a value to the filter, and the filter returns a value to change its behaviour.

The documentation is referring to the latter.

Props johnbillion.
See #49572, #16557.
Built from https://develop.svn.wordpress.org/trunk@48185


git-svn-id: http://core.svn.wordpress.org/trunk@47954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-26 18:49:09 +00:00
Sergey Biryukov
e13c363b17 Docs: Capitalize "ID", when referring to a post ID, term ID, etc. in a more consistent way.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48104


git-svn-id: http://core.svn.wordpress.org/trunk@47873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:02:12 +00:00
John Blackbourn
37234874a5 Docs: Misc improvements to inline docs.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48099


git-svn-id: http://core.svn.wordpress.org/trunk@47868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-19 22:28:13 +00:00
Sergey Biryukov
de59ad23a4 Docs: Consistently include an empty line between @since tag and @see, @link, or @global, per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48067


git-svn-id: http://core.svn.wordpress.org/trunk@47834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-16 21:07:14 +00:00
Sergey Biryukov
a1f8dd4972 Posts, Post Types: Introduce default_category_post_types filter.
The filter allows custom post types associated with the `category` taxonomy to opt in to requiring a default category, same as regular posts.

Props enrico.sorcinelli.
Fixes #43516.
Built from https://develop.svn.wordpress.org/trunk@48043


git-svn-id: http://core.svn.wordpress.org/trunk@47810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-14 21:42:17 +00:00
Sergey Biryukov
18a9359c06 Posts, Post Types: Display a more specific error message when an attachment could not be inserted into the database.
Props shital-patel, Presskopp, ocean90.
Fixes #50325.
Built from https://develop.svn.wordpress.org/trunk@47922


git-svn-id: http://core.svn.wordpress.org/trunk@47696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-07 09:24:11 +00:00
Sergey Biryukov
72b5018aa3 Docs: Miscellaneous DocBlock corrections.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@47892


git-svn-id: http://core.svn.wordpress.org/trunk@47666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-03 10:02:13 +00:00
Dominik Schilling
a01835679a Posts, Post Types: Pass the post object to the delete_attachment action.
Also add the missing `$post` parameter to the `delete_post` and `deleted_post` actions in `wp_delete_attachment()`.

See #30940.
Built from https://develop.svn.wordpress.org/trunk@47856


git-svn-id: http://core.svn.wordpress.org/trunk@47632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-26 14:49:06 +00:00
Sergey Biryukov
5b4174e409 Coding Standards: Use strict comparison for more count() calls.
Follow-up to [47848].

Props mukesh27.
Fixes #50232. See #49542.
Built from https://develop.svn.wordpress.org/trunk@47851


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