Commit Graph

1156 Commits

Author SHA1 Message Date
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
Sergey Biryukov
b9751d4efe Coding Standards: Use strict comparison for count() calls.
See #49542.
Built from https://develop.svn.wordpress.org/trunk@47848


git-svn-id: http://core.svn.wordpress.org/trunk@47624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-23 11:38:08 +00:00
Sergey Biryukov
7932193708 Coding Standards: Use strict comparison where static strings are involved.
This reduces the number of `WordPress.PHP.StrictComparisons.LooseComparison` issues in half, from 1897 to 890.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47808


git-svn-id: http://core.svn.wordpress.org/trunk@47584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-16 18:42:12 +00:00
whyisjake
55cd633c37 Customize: Add additional filters to Customizer to prevent JSON corruption.
This solution extends the wp_insert_post_data filter to pass in addition to the slashed/sanitized/processed data, and the slashed/sanitized/unprocessed data, to also pass the initial slashed/unsanitized/unprocessed data which was passed into wp_insert_post(). This then allows plugins to have complete control over how sanitization is performed based on the post type.

Props westonruter, peterwilsoncc, sstoqnov, whyisjake, xknown.
 

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


git-svn-id: http://core.svn.wordpress.org/trunk@47408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-29 15:14:10 +00:00
Sergey Biryukov
427405535f Docs: Synchronize parameter documentation for various metadata functions, update per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@47611


git-svn-id: http://core.svn.wordpress.org/trunk@47386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-22 10:31:09 +00:00
Sergey Biryukov
9aa0fff80e Docs: Document the default value of $single and $prev_value parameters in various metadata functions.
Props denisco.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@47610


git-svn-id: http://core.svn.wordpress.org/trunk@47385 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-22 09:40:10 +00:00
Dominik Schilling
2d04c2e5c8 Posts, Post Types: Pass the post object to the before_delete_post, delete_post, deleted_post, and after_delete_post actions.
Props jadpm.
Fixes #30940.
Built from https://develop.svn.wordpress.org/trunk@47582


git-svn-id: http://core.svn.wordpress.org/trunk@47357 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-14 19:26:07 +00:00
Sergey Biryukov
856e1a27b8 Coding Standards: Use strict type check for in_array() and array_search().
This addresses all the remaining `WordPress.PHP.StrictInArray.MissingTrueStrict` issues in core.

Includes minor code layout fixes for better readability.

Follow-up to [47550].

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47557


git-svn-id: http://core.svn.wordpress.org/trunk@47332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-09 15:43:10 +00:00
Sergey Biryukov
38676936ba Coding Standards: Use strict type check for in_array() and array_search() where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47550


git-svn-id: http://core.svn.wordpress.org/trunk@47325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-05 03:02:11 +00:00
John Blackbourn
7004afe4f4 Docs: Various docblock corrections and improvements.
See #49572
Built from https://develop.svn.wordpress.org/trunk@47461


git-svn-id: http://core.svn.wordpress.org/trunk@47248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-16 18:40:07 +00:00
Peter Wilson
a88ac4f003 Media: Introduce preflight filter to wp_delete_attachment().
Introduces the filter `pre_delete_attachment` to allow developers to prevent or modify the deletion of attachments. This improves consistency with `wp_delete_post()` and `wp_trash_post()`.

Props joemcgill, peterwilsoncc.
Fixes #49597.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-10 22:48:07 +00:00
John Blackbourn
46674e2367 Docs: Correct and improve the docs for some media related functions.
See #48303
Built from https://develop.svn.wordpress.org/trunk@47394


git-svn-id: http://core.svn.wordpress.org/trunk@47181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-29 16:49:07 +00:00
Sergey Biryukov
c60ea3261f Docs: Add a @since note for including delete_posts in default capabilities in get_post_type_capabilities().
Follow-up to [47357].

See #30991.
Built from https://develop.svn.wordpress.org/trunk@47358


git-svn-id: http://core.svn.wordpress.org/trunk@47145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-25 12:55:08 +00:00
Sergey Biryukov
aaccfc063f Posts, Post Types: Ensure delete_posts is included in default post type capabilities regardless of map_meta_cap value.
This resolves PHP notices in a few places in core where this capability is checked.

Props Mte90, johnbillion, dipesh.kakadiya, jipmoors, bamadesigner, dd32, johnjamesjacoby, xedin.unknown, flixos90, SergeyBiryukov.
Fixes #30991.
Built from https://develop.svn.wordpress.org/trunk@47357


git-svn-id: http://core.svn.wordpress.org/trunk@47144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-25 12:50:06 +00:00
Sergey Biryukov
e67b01895b Posts, Post Types: Discard tags_input parameter in wp_update_post() if it's the same as existing post tags.
This ensures that `wp_update_post()` does not unintentionally modify post tags if the post has several tags with the same name but different slugs.

Tags should only be modified if `tags_input` parameter was explicitly provided, and is different from the existing tags.

Props kaggdesign, SergeyBiryukov.
Fixes #45121.
Built from https://develop.svn.wordpress.org/trunk@47317


git-svn-id: http://core.svn.wordpress.org/trunk@47115 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-19 03:52:09 +00:00
Andrew Ozz
a2accf4db7 Media: Pass through the $unfiltered param to get_attached_file() in wp_get_original_image_path().
Props ianmjones, joemcgill, azaozz.
Fixes #48421.
Built from https://develop.svn.wordpress.org/trunk@47274


git-svn-id: http://core.svn.wordpress.org/trunk@47074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-11 19:47:07 +00:00
Sergey Biryukov
a6949956d1 Administration: Capitalize Trash consistently in various messages and comments.
When used as a noun referring to the "virtual" place, `Trash` should be capitalized.

Props garrett-eclipse, aandrewdixon, Presskopp.
Fixes #45317.
Built from https://develop.svn.wordpress.org/trunk@47233


git-svn-id: http://core.svn.wordpress.org/trunk@47033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-10 04:12:07 +00:00
Sergey Biryukov
641c632b0c Coding Standards: Use Yoda conditions where appropriate.
See #49222.
Built from https://develop.svn.wordpress.org/trunk@47219


git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-09 16:55:09 +00:00
John Blackbourn
352ac8bf35 Posts, Post Types: Introduce a filter which allows the addition of __trashed suffixes on post slugs to be skipped.
Fixes #46433
Built from https://develop.svn.wordpress.org/trunk@47203


git-svn-id: http://core.svn.wordpress.org/trunk@47003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-07 17:33:06 +00:00
Sergey Biryukov
39e133bce8 Posts, Post Types: Add default menu_icon values for built-in post types.
This allows the icons to be retrieved via `get_post_type_object()`.

Props m.usama.masood, michael.ecklund, SergeyBiryukov.
Fixes #38844.
Built from https://develop.svn.wordpress.org/trunk@47196


git-svn-id: http://core.svn.wordpress.org/trunk@46996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-05 22:40:05 +00:00
Sergey Biryukov
9ed35cf902 Posts, Post Types: Change "Featured Image" post label to use sentence case: "Featured image".
This makes it more consistent with other UI elements in the block editor.

Props mcsf.
Fixes #49371.
Built from https://develop.svn.wordpress.org/trunk@47194


git-svn-id: http://core.svn.wordpress.org/trunk@46994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-05 19:09:05 +00:00
Sergey Biryukov
001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
Sergey Biryukov
9fa4cce9c2 Docs: Correct description for show_in_admin_all_list and show_in_admin_status_list arguments of register_post_status().
Props audrasjb.
Fixes #49180.
Built from https://develop.svn.wordpress.org/trunk@47066


git-svn-id: http://core.svn.wordpress.org/trunk@46866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-13 00:50:02 +00:00
Sergey Biryukov
396647666f Docs: Various documentation fixes for unit test factories.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@46985


git-svn-id: http://core.svn.wordpress.org/trunk@46785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-18 00:19:02 +00:00
Sergey Biryukov
8eb278d19a Docs: Clarify that get_lastpostdate() and get_lastpostmodified() can return false on failure.
The both use `_get_last_post_time()` internally.

Props Rarst.
See #48957.
Built from https://develop.svn.wordpress.org/trunk@46973


git-svn-id: http://core.svn.wordpress.org/trunk@46773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-17 20:26:01 +00:00
Sergey Biryukov
c0b6dffffc Date/Time: In wp_insert_post(), when checking the post date to set future or publish status, use a proper delta comparison.
[3525] allowed a difference up to 59 seconds between the post date/time and the current time to consider the post published instead of scheduled, but that didn't take start of a new minute into account.

Rapidly creating post fixtures in unit tests could encounter a one-second discrepancy between `current_time( 'mysql' )` and `gmdate( 'Y-m-d H:i:s' )`, returning values like `2019-12-16 23:43:00` vs. `2019-12-16 23:42:59`, respectively, and setting the post to a `future` status instead of `publish`.

[45851], while working as intended, made the issue somewhat more likely to occur.

This caused all sorts of occasional random failures in various tests on Travis, mostly on PHP 7.1.

Fixes #48145.
Built from https://develop.svn.wordpress.org/trunk@46968


git-svn-id: http://core.svn.wordpress.org/trunk@46768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-17 02:25:03 +00:00
Sergey Biryukov
3d623995a8 Docs: In various @return tags, list the expected type first, instead of WP_Error.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@46696


git-svn-id: http://core.svn.wordpress.org/trunk@46496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-11 02:43:03 +00:00
Sergey Biryukov
1f816ad18d Docs: Use the {@see ...} tag for the replacement in @deprecated tags, so that Developer Reference could automatically link to the replacement.
Props jrf.
See #48255.
Built from https://develop.svn.wordpress.org/trunk@46685


git-svn-id: http://core.svn.wordpress.org/trunk@46485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-09 13:05:02 +00:00
Sergey Biryukov
f60094679f Coding Standards: Consistently use do_action_deprecated() and apply_filters_deprecated() for deprecated hooks.
Props jrf.
See #48255.
Built from https://develop.svn.wordpress.org/trunk@46684


git-svn-id: http://core.svn.wordpress.org/trunk@46484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-09 12:59:03 +00:00
John Blackbourn
f545bb3f63 Docs: Improve documentation of known return types, plus other docs fixes.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-05 21:23:02 +00:00
John Blackbourn
3caaa40fc6 Docs: Switch more docs over to typed array notation, plus some fixes.
See #48303, #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@46393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 21:09:04 +00:00
Andrew Ozz
f7968ccb92 Media: Similarly to wp_get_original_image_path() add wp_get_original_image_url() to always retrieve the URL to the original uploaded image.
Props kraftbj.
Fixes #48302.
Built from https://develop.svn.wordpress.org/trunk@46553


git-svn-id: http://core.svn.wordpress.org/trunk@46350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-15 19:12:02 +00:00
Sergey Biryukov
8d1e51e9c7 Docs: Add a @since note about new parameters with the spread operator added to function signatures.
Props jrf.
See #47678.
Built from https://develop.svn.wordpress.org/trunk@46451


git-svn-id: http://core.svn.wordpress.org/trunk@46249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-09 04:28:02 +00:00
Sergey Biryukov
fefc2f56ed I18N: Add context for the Archives string introduced in [45651] as a file type heading, to disambiguate from other types of archives.
Props alexclassroom.
Fixes #48259.
Built from https://develop.svn.wordpress.org/trunk@46437


git-svn-id: http://core.svn.wordpress.org/trunk@46235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-08 17:04:03 +00:00
John Blackbourn
235373d4d7 Pings/Trackbacks: Avoid adding multiple _pingme and _encloseme meta entries to a post when it gets updated prior to pings being done.
Props rebasaurus, whyisjake

Fixes #48014

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


git-svn-id: http://core.svn.wordpress.org/trunk@46224 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-07 20:29:04 +00:00
Andrew Ozz
38e6958698 Media: Move wp_get_original_image_path() to wp-content/post.php to make it easier to access from plugins.
Props pbiron.
See #47873.
Built from https://develop.svn.wordpress.org/trunk@46353


git-svn-id: http://core.svn.wordpress.org/trunk@46152 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-30 16:28:59 +00:00
Sergey Biryukov
c7f4cbc62c Docs: Improve consistency in @since tags for parameters that were made optional.
See #47110.
Built from https://develop.svn.wordpress.org/trunk@46288


git-svn-id: http://core.svn.wordpress.org/trunk@46100 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-24 12:54:57 +00:00
K. Adam White
81ed396972 Posts, Post Types: Build list of "date floating" post stati dynamically when inserting post.
Completes work begun in #39953 to expose "date floating" status information to frontend clients via the REST API.

Props TimothyBlynJacobs.
Fixes #48113.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46091 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-23 21:02:56 +00:00