Commit Graph

33 Commits

Author SHA1 Message Date
Scott Taylor
5c6c4e3713 Posts: In wp_insert_post(), don't set post_date to current time if it can be derived from a passed value for post_date_gmt.
Adds unit tests.

Props oso96_2000, kawauso.
Fixes #15946.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-02 04:36:24 +00:00
Drew Jaynes
a985977856 Docs: Update the argument descriptions for $child_of and $hierarchical in get_pages() to more closely reflect expected behavior.
See #18701. See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-01 17:40:25 +00:00
Drew Jaynes
8b4c499664 Docs: There are quite alot of typos in core inline comments.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-30 04:13:48 +00:00
Gary Pendergast
1db89dd3bf Rewrite: Redirect attachment URLs when their slug changes.
Using the same logic that we use to redirect posts when their slug changes, we can provide the same functionality for attachments. Attachment pages are posts, too.

Props swissspdy.

Fixes #34043.


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


git-svn-id: http://core.svn.wordpress.org/trunk@34649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-29 04:58:25 +00:00
John Blackbourn
5bfa878fee Correctly slash post fields when trashing and untrashing posts.
Fixes #27550
Props dmenard, Denis-de-Bernardy

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


git-svn-id: http://core.svn.wordpress.org/trunk@34632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-28 19:26:25 +00:00
John Blackbourn
aa35e473f7 callback is not a valid type in PHP, PSR-5, or phpDocumentor. callable should be used instead.
Fixes #34032

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


git-svn-id: http://core.svn.wordpress.org/trunk@34530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 23:58:25 +00:00
John Blackbourn
949b6ee1df Convert the $args passed to register_post_type() into an array before passing them to the new register_post_type_args filter.
Fixes #17447

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


git-svn-id: http://core.svn.wordpress.org/trunk@34477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 19:39:25 +00:00
Scott Taylor
8cc5a142e4 Media Modal: move the translation strings for insertIntoPost and uploadedToThisPost to the get_post_type_labels() array as insert_into_item and uploaded_to_this_item.
Props flixos90.
Fixes #33616.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 03:22:24 +00:00
Sergey Biryukov
18d95526f6 Make the 'register_post_type_args' filter introduced in [34242] available for built-in post types too.
Props MikeSchinkel.
Fixes #17447.
Built from https://develop.svn.wordpress.org/trunk@34451


git-svn-id: http://core.svn.wordpress.org/trunk@34415 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 22:32:24 +00:00
Scott Taylor
939d9b7395 Remove some unused globals and/or their docs.
See ##33491.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34410 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 20:27:25 +00:00
Drew Jaynes
fc7fa6d2d9 Docs: Clarify the file header summary for wp-includes/post-functions.php, introduced in [33759].
See #33413. See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 13:12:24 +00:00
John Blackbourn
707f0d9108 Add @since docs for the show_ui argument in register_post_type().
See #33763

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


git-svn-id: http://core.svn.wordpress.org/trunk@34317 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-20 09:05:24 +00:00
Scott Taylor
a87ef29978 In wp_mime_type_icon(), the length of the $wilds array varies depending on what is passed as $mime. Loop over $wilds instead of arbitrarily checking $wilds[0].
Adds unit tests.

Fixes #33012.


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


git-svn-id: http://core.svn.wordpress.org/trunk@34219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-17 00:37:25 +00:00
Boone Gorges
5eae305403 Throw a notice when an invalid tax is passed to wp_insert_post().
Props jdgrimes.
Fixes #25477.
Built from https://develop.svn.wordpress.org/trunk@34248


git-svn-id: http://core.svn.wordpress.org/trunk@34212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-16 19:25:26 +00:00
Sergey Biryukov
dd11460efa Add register_post_type_args filter for changing register_post_type() arguments before further processing.
Does not apply to built-in post types.

Props MikeSchinkel, nickciske, engelen, swissspidy.
Fixes #17447.
Built from https://develop.svn.wordpress.org/trunk@34242


git-svn-id: http://core.svn.wordpress.org/trunk@34206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-16 15:47:25 +00:00
Sergey Biryukov
aee733684b Docs: Synchronize the $timezone parameter description between get_lastpostdate(), get_lastpostmodified(), and _get_last_post_time().
See #17455.
Built from https://develop.svn.wordpress.org/trunk@34240


git-svn-id: http://core.svn.wordpress.org/trunk@34204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-16 15:29:39 +00:00
Scott Taylor
8573a86def In WP::parse_request(), don't add query vars of non-viewable post types to WP::public_query_vars. In register_post_type(), don't add query vars of non-viewable post types to WP::public_query_vars.
In `_unregister_post_type()` (unit tests), don't add query vars of non-viewable post types to `WP::public_query_vars`.

Adds unit test.

Fixes #30018.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34179 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-15 18:54:30 +00:00
Scott Taylor
b07b68490f Allow get_lastpostdate(), get_lastpostmodified(), and _get_last_post_time() to accept $post_type and cache separately.
Props _duck, SergeyBiryukov.
See #17455.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34165 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-15 15:25:31 +00:00
Scott Taylor
191400f9e6 Don't ever use the guid value when retrieving URLs for media, use wp_get_attachment_url(). Use get_attached_file() for path to file.
Fixes #33386.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34131 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-15 02:50:25 +00:00
Scott Taylor
31c2bfd69d More bonkers comment cache cleanup: toggle wp_defer_comment_counting() in wp_insert_post() and wp_insert_attachment(). Move the cache deletion in wp_update_comment_count_now() to before the get_post() call, so that the caches get deleted even if the post has already been deleted and the function returns early.
See #33875.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-15 00:58:26 +00:00
Scott Taylor
9604c74f62 Objects are passed by-reference since PHP 5. In _get_custom_object_labels(), cast $object->labels back to object before returning. This function is weird.
Adds unit test.

Props Toro_Unit.
Fixes #33023.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-14 01:23:26 +00:00
Scott Taylor
5077d917a3 Check if the $post_type passed to get_post_type_object() is a scalar value. Non-scalars were producing PHP warnings.
Adds unit tests.

Props Kloon.
Fixes #30013.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-14 00:03:24 +00:00
Scott Taylor
8977166746 In wp_insert_post(), when setting $post_author, use isset() instead of ! empty() to allow 0 to be passed as the value for $post_author.
Adds unit tests.

Props ericdaams, wonderboymusic.
Fixes #32585.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-12 18:54:25 +00:00
Scott Taylor
5a21742a6f wp_delete_post(): add a filter, 'pre_delete_post', to allow bailout from the function if the filter returns a non-null value.
Props boonebgorges.
Fixes #32933.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-12 15:59:24 +00:00
Scott Taylor
891b76e034 sanitize_post(): the default value for $context is 'display'. The documentation says the default for sanitize_post_field() is 'display', but there is no default for the arg. Make the argument: $context = 'default'.
Props morganestes.
Fixes #33117.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-12 15:46:25 +00:00
Scott Taylor
0b412d3333 sanitize_post() is polymorphic, add an is_array() check for $post before operating on it as an array.
Props morganestes.
Fixes #33118.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-12 15:38:27 +00:00
Scott Taylor
47409875ab In get_page_uri(), do not add parent slugs to orphaned pages.
Adds unit test.

Props filosofo, MikeHansenMe, MikeHansenMe, chriscct7.
Fixes #15963. 

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


git-svn-id: http://core.svn.wordpress.org/trunk@33970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-10 16:54:24 +00:00
Scott Taylor
c1bb5b5ce3 After [33843], update the location of some files in This filter is documented in docs
Props dimadin.
See #33413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-08 22:17:26 +00:00
Sergey Biryukov
0424d962e1 Update the parameter docs for wp_add_post_tags(), wp_set_post_tags(), and wp_set_post_terms().
Props johnbillion.
Fixes #33749.
Built from https://develop.svn.wordpress.org/trunk@33931


git-svn-id: http://core.svn.wordpress.org/trunk@33900 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-06 00:12:26 +00:00
John Blackbourn
9e6f9a5d93 Function docs for the tax_input and meta_input parameters available for wp_insert_post().
See #20451

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


git-svn-id: http://core.svn.wordpress.org/trunk@33891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-05 21:02:24 +00:00
Scott Taylor
102a8aecf8 Allow wp_insert_post() to accept a meta_input argument. Devs should use register_meta() to ensure that specific values specified by key are sanitized properly.
Adds unit test.

Props CoenJacobs, swissspidy.
Fixes #20451.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-05 19:50:24 +00:00
Sergey Biryukov
4e77ffdee1 In get_post_type_labels(), ensure that filtered labels contain all required default values.
fixes #33543.
Built from https://develop.svn.wordpress.org/trunk@33776


git-svn-id: http://core.svn.wordpress.org/trunk@33744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 03:39:21 +00:00
Scott Taylor
cd99e0cfff Posts: move WP_Post into its own file. post.php loads the new files, so this is 100% BC if someone is loading post.php directly. New files created using svn cp.
Creates: 
`class-wp-post.php` 
`post-functions.php` 

`post.php` contains only top-level code. Class file only contains the class. Functions file only contains functions.

See #33413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-26 12:40:21 +00:00