Commit Graph

1201 Commits

Author SHA1 Message Date
audrasjb 5d9e922dea Grouped backports to the 5.6 branch.
- Editor: Bump @wordpress packages for the branch,
- Media: Refactor search by filename within the admin,
- REST API: Lockdown post parameter of the terms endpoint,
- Customize: Escape blogname option in underscores templates,
- Query: Validate relation in `WP_Date_Query`,
- Posts, Post types: Apply KSES to post-by-email content,
- General: Validate host on "Are you sure?" screen,
- Posts, Post types: Remove emails from post-by-email logs,
- Pings/trackbacks: Apply KSES to all trackbacks,
- Mail: Reset PHPMailer properties between use,
- Comments: Apply kses when editing comments,
- Widgets: Escape RSS error messages for display.

Merges [54521-54530] to the 5.6 branch.
Props audrasjb, costdev, cu121, dd32, davidbaumwald, ehtis, johnbillion, johnjamesjacoby, martinkrcho, matveb, oztaser, paulkevan, peterwilsoncc, ravipatel, SergeyBiryukov, talldanwp, timothyblynjacobs, tykoted, voldemortensen, vortfu, xknown.

Built from https://develop.svn.wordpress.org/branches/5.6@54555


git-svn-id: http://core.svn.wordpress.org/branches/5.6@54110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-17 17:57:59 +00:00
desrosj bbc7ab2628 Grouped backports to the 5.6 branch.
- Query: Improve sanitization within `WP_Tax_Query`.
- Query: Improve sanitization within `WP_Meta_Query`.
- Upgrade/Install: Avoid using `unserialize()` unnecessarily.
- Formatting: Correctly encode ASCII characters in post slugs.

Merges [52454-52457] to the 5.6 branch.
Props vortfu, dd32, ehtis, zieladam, whyisjake, xknown, peterwilsoncc, desrosj, iandunn.
Built from https://develop.svn.wordpress.org/branches/5.6@52467


git-svn-id: http://core.svn.wordpress.org/branches/5.6@52059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-01-06 17:58:00 +00:00
Sergey Biryukov c08b929a9e 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.
Merges [50051] to the 5.6 branch.
See #52196.
Built from https://develop.svn.wordpress.org/branches/5.6@50052


git-svn-id: http://core.svn.wordpress.org/branches/5.6@49753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-28 10:44:08 +00:00
whyisjake 126a488b6f 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.

This changeset brings [50039] to the 5.6 branch.

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

Built from https://develop.svn.wordpress.org/branches/5.6@50040


git-svn-id: http://core.svn.wordpress.org/branches/5.6@49741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-28 00:09:57 +00:00
John Blackbourn 670319d84d 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.

This merges [45114] into the 5.6 branch

See #45114

Built from https://develop.svn.wordpress.org/branches/5.6@49732


git-svn-id: http://core.svn.wordpress.org/branches/5.6@49455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-01 20:57:05 +00:00
Sergey Biryukov 5bbff0b5d6 Docs: Correct `$fire_after_hooks` parameter name in `@since` tags.
Follow-up to [49172], [49173].

Merges [49673] to the 5.6 branch.
Reviewed by peterwilsoncc, SergeyBiryukov.
Fixes #45114.
Built from https://develop.svn.wordpress.org/branches/5.6@49684


git-svn-id: http://core.svn.wordpress.org/branches/5.6@49407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-23 18:59:05 +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