Commit Graph

937 Commits

Author SHA1 Message Date
Andrew Nacin
4b40e7a646 More adjustments and improvements for inline documentation for get_pages(). see #25186.
Built from https://develop.svn.wordpress.org/trunk@25271


git-svn-id: http://core.svn.wordpress.org/trunk@25237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 01:21:09 +00:00
Scott Taylor
54c5a75e68 Simplify the check for false-y child_of arg.
Props SergeyBiryukov.
See #25230, [25245].


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


git-svn-id: http://core.svn.wordpress.org/trunk@25236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-05 23:36:10 +00:00
Scott Taylor
cc41e7d04a Fix spacing in docs for get_pages().
Props DrewAPicture.
See #25186.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-05 23:21:10 +00:00
Scott Taylor
1855f97a2c Add docs to the woefully under-documented get_pages().
Props DrewAPicture.
Fixes #25186.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-05 22:13:09 +00:00
Scott Taylor
d1a40562eb Add check to make sure a valid argument was passed to get_page_uri().
Props Viper007Bond.
Fixes #24491.



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


git-svn-id: http://core.svn.wordpress.org/trunk@25230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-05 21:42:10 +00:00
Scott Taylor
6253183ffc Set hierarchical to false when parent is passed to get_pages() and child_of is not.
Fixes #25230.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-04 21:00:09 +00:00
Scott Taylor
bf6da40cfc Allow get_pages() to accept an array for the arg parent. Adds unit tests, some will fail until the next commit.
Fixes #9470.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-04 20:56:09 +00:00
Scott Taylor
f1a33028f6 Allow int to be passed in lieu of array, add append arg to wp_set_post_categories(). Adds more extensive unit tests for wp_set_post_categories().
Props ptahdunbar for initial patch.
Fixes #16550.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-04 17:42:10 +00:00
Jon Cave
93b2edbbba Correct rewrite tag for hierarchical post types without a query_var.
Hierarchical rewrite rules operate via the 'pagename' query variable which is
passed to get_page_by_path(). However, the current rewrite rules use the 'name'
query variable for hierarchical types without a custom query_var.

Fixes #16323.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25154 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-30 08:08:09 +00:00
Scott Taylor
7c1ea6c95c No need to re-map the return values of wp_parse_id_list() to int.
See #22074, #11823.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-29 18:54:09 +00:00
Scott Taylor
0624fe960b Improve the include / exclude SQL generation in get_pages() by using IN and NOT IN where applicable. Adds unit tests for include / exclude.
Fixes #22074.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-29 18:49:09 +00:00
Scott Taylor
8e6abf65a8 Respect the fields arg when passed to get_children().
Fixes #22208.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-29 15:08:12 +00:00
Dominik Schilling
357f52eed7 Improve inline docs for register_post_type() and register_taxonomy().
* register_taxonomy: Use the same doc format for the associative array arg as used for register_post_type()
* register_taxonomy: Improve docs for _builtin, capabilities, hierarchical and rewrite args
* register_taxonomy: Use the same order in $defaults as in docblock
* register_taxonomy: Replace is_null with null ===, to be consistent
* register_post_type: Use the same order in $defaults as in docblock
* register_post_type: Improve docs for @uses and default fallbacks
And while we're on it: Whitespaces.

fixes #25150.
Built from https://develop.svn.wordpress.org/trunk@25130


git-svn-id: http://core.svn.wordpress.org/trunk@25110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-26 20:24:08 +00:00
Sergey Biryukov
b86ea82b12 Fix typo in phpdoc. props jamescollins. fixes #25092.
Built from https://develop.svn.wordpress.org/trunk@25097


git-svn-id: http://core.svn.wordpress.org/trunk@25079 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-22 23:48:09 +00:00
Andrew Nacin
fa4c7a1feb PHPDoc for WP_Post properties. fixes #25092.
Built from https://develop.svn.wordpress.org/trunk@25086


git-svn-id: http://core.svn.wordpress.org/trunk@25070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-22 15:58:09 +00:00
Scott Taylor
a9dc60c9a8 Improve inline docs for function params that can be serialized when non-scalar. Fixes #18488.
Built from https://develop.svn.wordpress.org/trunk@25076


git-svn-id: http://core.svn.wordpress.org/trunk@25061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-21 21:11:09 +00:00
Dominik Schilling
8ad024f30a Introduce save_post_{$post_type} hook.
The hook is fired before the general save_post hook and has the same args as save_post.

props bmb, SergeyBiryukov, ocean90, fixes #16176.
Built from https://develop.svn.wordpress.org/trunk@25050


git-svn-id: http://core.svn.wordpress.org/trunk@25037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-17 20:21:09 +00:00
Andrew Nacin
08c4061af7 In get_attached_file(), fix the explanation of when the filter is bypassed. props devesine, fixes #24571.
git-svn-id: http://core.svn.wordpress.org/trunk@24983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-05 22:07:42 +00:00
Andrew Nacin
487327cf4e Pass $update = true to the save_post and wp_insert_post hooks in wp_publish_post().
see #21450, [24823].

props wpsmith.
fixes #24957.


git-svn-id: http://core.svn.wordpress.org/trunk@24977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-05 21:41:51 +00:00
Andrew Nacin
c95a24f2d9 When registering a post type, pass the correct argument for feeds to add_permastruct().
props butuzov, johnpbloch.
fixes #23302.



git-svn-id: http://core.svn.wordpress.org/trunk@24830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-28 22:28:18 +00:00
Andrew Nacin
87f9d112c0 Return an empty stdClass from wp_count_posts() when a nonexistent post type is requested.
props johnpbloch.
fixes #24803.



git-svn-id: http://core.svn.wordpress.org/trunk@24826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-28 21:38:00 +00:00
Andrew Nacin
aa6d93cd3e Pass $update to the save_post and wp_insert_post hooks in wp_insert_post(). props ericmann, fixes #21450.
git-svn-id: http://core.svn.wordpress.org/trunk@24823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-28 21:05:25 +00:00
Michael Adams
f993cfd8e3 Fix inline docs for posts functions that no longer use $wpdb.
Props jdgrimes, JustinSainton.


git-svn-id: http://core.svn.wordpress.org/trunk@24807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-28 18:52:56 +00:00
Andrew Nacin
df0ac70aff Add a default post_title value to wp_insert_attachment() to avoid a notice when there is no ID3 title.
props wonderboymusic.
see #24805.



git-svn-id: http://core.svn.wordpress.org/trunk@24759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-20 20:20:47 +00:00
Andrew Nacin
ab72605607 More clear and concise escaping in get_page_by_path(). see #21767.
git-svn-id: http://core.svn.wordpress.org/trunk@24715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-16 14:23:29 +00:00
Andrew Nacin
092a33115c Remove wp_parse_post_content(), get_paged_content(), paginate_content() from 3.6, and remove the new $id parameters for get_the_content() and the_content().
The content parsing functions are good abstractions, but are no longer needed by core and are too closely tied to legacy globals, rather than paving a new path.

For get_the_content() and the_content(), this only worsens the function prototype. It muddies theme-specific display (more links, etc) with filtered content. `apply_filters( 'the_content', $post->post_content )` is sufficient practice for now.

see #24330, [24301]. see #23625, [23804].



git-svn-id: http://core.svn.wordpress.org/trunk@24598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-09 05:22:50 +00:00
Sergey Biryukov
58c364947f PHPDoc fixes and additions. fixes #24616.
git-svn-id: http://core.svn.wordpress.org/trunk@24490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-21 12:45:11 +00:00
Mark Jaquith
28e3c51dab Lose content removal and splitting from the media extraction functions.
see #24484

git-svn-id: http://core.svn.wordpress.org/trunk@24400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-03 19:27:58 +00:00
Mark Jaquith
89fd06e44b First pass at removing Post Format UI.
see #24452. fixes #24455.

git-svn-id: http://core.svn.wordpress.org/trunk@24388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-30 21:33:46 +00:00
Ryan Boren
a2b4bc456f * Introduce wp_parse_post_content() and use it in setup_postdata(), get_the_content(), and get_the_remaining_content().
* Add a post ID argument to the_content(), get_the_content(), the_remaining_content(), and get_the_remaining_content().
* Pass the post ID to the the_content filter.
* Remove the format_pages global.
* Declare format_content and split_content as vars in WP_Post.
* phpdoc for the the_content filter that documents the new ID argument and denotes it as not-so-portable.

Props gcorne, DrewAPicture, duck_, aaroncampbell
see #24330


git-svn-id: http://core.svn.wordpress.org/trunk@24301 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-20 11:05:50 +00:00
Sergey Biryukov
396166203e Fix handling of '0' as meta_value argument in get_pages(). fixes #20376.
git-svn-id: http://core.svn.wordpress.org/trunk@24238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-10 19:18:54 +00:00
Sergey Biryukov
74638ccb5a Fix typos in phpdoc. props TheLastCicada. fixes #24302.
git-svn-id: http://core.svn.wordpress.org/trunk@24229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-10 01:39:30 +00:00
Sergey Biryukov
57c10eadbb Use ellipsis instead of three dots. props tjsingleton, jordie23, wojtek.szkutnik, DrewAPicture, SergeyBiryukov. see #8714.
git-svn-id: http://core.svn.wordpress.org/trunk@24207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-08 21:27:31 +00:00
Andrew Nacin
92b4636e17 Required arguments can't follow optional arguments.
Make required arguments optional in confirm_blog_signup().

Mark arguments as required in _future_post_hook(), the walker method display_element(), get_author_link() (deprecated), and the WP_Widget constructor.

props rlerdorf.
see #24210.



git-svn-id: http://core.svn.wordpress.org/trunk@24126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-29 13:26:31 +00:00
Mark Jaquith
7c1ef6c33a Use get_post_format() instead of assuming we already have it.
* Fixes an issue where image posts without a title could not be deleted

fixes #23887. see #24046. props WraithKenny, SergeyBiryukov.

git-svn-id: http://core.svn.wordpress.org/trunk@24015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-17 17:49:44 +00:00
Mark Jaquith
259f4fdef4 Allow the content of no-title audio, video, quote, and image posts to be blanked.
props wonderboymusic. fixes #23623.

git-svn-id: http://core.svn.wordpress.org/trunk@23986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-14 01:43:01 +00:00
Mark Jaquith
cccb2939db Fix a longstanding "off by one" revision authorship bug.
* Fixes old revision data on the fly when you open a post for editing.
* Uses post_name of revisions to store a post version number (-v1), so we know what has been fixed.
* Latest version should also have a revision stored, whereas before it did not.

props adamsilverstein, mdawaffe. fixes #16215.

git-svn-id: http://core.svn.wordpress.org/trunk@23823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-27 20:21:38 +00:00
Ryan Boren
77f431ec4c Bail early with correct WP_Error when an invalid post ID is passed to wp_insert_post() and wp_update_post().
Props simonwheatley
fixes #23474


git-svn-id: http://core.svn.wordpress.org/trunk@23740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-18 14:33:09 +00:00
Sergey Biryukov
27298cd802 Remove redundant code from post_type_supports() and remove_post_type_support(). props obenland, bilalcoder. fixes #21527.
git-svn-id: http://core.svn.wordpress.org/trunk@23722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-15 18:28:33 +00:00
Andrew Nacin
3828d67fad Allow get_post_ancestors() to inspect the $post global, when null/0 is received. see #23708.
git-svn-id: http://core.svn.wordpress.org/trunk@23635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-07 06:49:46 +00:00
Ryan Boren
315bfb019a Use wp_unslash() instead of stripslashes() and stripslashes_deep(). Use wp_slash() instead of add_magic_quotes().
see #21767


git-svn-id: http://core.svn.wordpress.org/trunk@23594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-03 21:11:40 +00:00
Ryan Boren
43a7e695e9 Revert 23416, 23419, 23445 except for wp_reset_vars() changes. We are going a different direction with the slashing cleanup, so resetting to a clean slate. see #21767
git-svn-id: http://core.svn.wordpress.org/trunk@23554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-01 16:28:40 +00:00
Andrew Nacin
5cd77fdb99 Revert [23359]. The post_author and comment_count post object fields will remain numeric strings for back compat. see #22324.
git-svn-id: http://core.svn.wordpress.org/trunk@23531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-28 19:40:26 +00:00
Andrew Nacin
b88b1c1f53 Move revisions/autosave and post format functions from wp-includes/post.php into revision.php and post-formats.php.
git-svn-id: http://core.svn.wordpress.org/trunk@23466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-21 21:24:34 +00:00
Helen Hou-Sandí
ad85d07189 Edit screen UI for post formats: a first run for functionality.
* Adds a very basic tabbed interface for selecting a post format (requires JS).
* Extra fields, which are post meta, are shown/hidden based on the selected format.
* Introduce a helper function for retrieving formats-specific metadata: `get_post_format_meta()`.
* Image selection uses the media modal, although without filtering or from URL support at the moment.

props rachelbaker, wonderboymusic, aaroncampbell, helen. see #19570.


git-svn-id: http://core.svn.wordpress.org/trunk@23449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-18 19:11:24 +00:00
Sergey Biryukov
a395bb01b8 Properly truncate UTF-8 post slugs in wp_unique_post_slug(). fixes #21013.
git-svn-id: http://core.svn.wordpress.org/trunk@23420 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-15 14:35:41 +00:00
Ryan Boren
cc5ed3a485 Change all core API to expect unslashed rather than slashed arguments.
The exceptions to this are update_post_meta() and add_post_meta() which are often used by plugins in POST handlers and will continue accepting slashed data for now.

Introduce wp_upate_post_meta() and wp_add_post_meta() as unslashed alternatives to update_post_meta() and add_post_meta(). These functions could become methods in WP_Post so don't use them too heavily yet.

Remove all escape() calls from wp_xmlrpc_server. Now that core expects unslashed data this is no longer needed.

Remove addslashes(), addslashes_gpc(), add_magic_quotes() calls on data being prepared for handoff to core functions that until now expected slashed data. Adding slashes in no longer necessary.

Introduce wp_unslash() and use to it remove slashes from GPCS data before using it in core API. Almost every instance of stripslashes() in core should now be wp_unslash(). In the future (a release or three) when GPCS is no longer slashed, wp_unslash() will stop stripping slashes and simply return what is passed. At this point wp_unslash() calls can be removed from core.

Introduce wp_slash() for slashing GPCS data. This will also turn into a noop once GPCS is no longer slashed. wp_slash() should almost never be used. It is mainly of use in unit tests.

Plugins should use wp_unslash() on data being passed to core API.

Plugins should no longer slash data being passed to core. So when you get_post() and then wp_insert_post() the post data from get_post() no longer needs addslashes(). Most plugins were not bothering with this. They will magically start doing the right thing. Unfortunately, those few souls who did it properly will now have to avoid calling addslashes() for 3.6 and newer.

Use wp_kses_post() and wp_kses_data(), which expect unslashed data, instead of wp_filter_post_kses() and wp_filter_kses(), which expect slashed data. Filters are no longer passed slashed data.

Remove many no longer necessary calls to $wpdb->escape() and esc_sql().

In wp_get_referer() and wp_get_original_referer(), return unslashed data.

Remove old stripslashes() calls from WP_Widget::update() handlers. These haven't been necessary since WP_Widget.

Switch several queries over to prepare().

Expect something to break.

Props alexkingorg
see #21767


git-svn-id: http://core.svn.wordpress.org/trunk@23416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-14 22:51:06 +00:00
Peter Westwood
ae974b8495 Revisions: Allow a plugin to force us to skip the don't save this revision because it hasn't changed code if it knows better.
See #7392 and #9843. Also cleans up the whitespace.


git-svn-id: http://core.svn.wordpress.org/trunk@23415 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-14 16:45:43 +00:00
Peter Westwood
716d48e0cd Revisions: Before saving a new post revision make sure that something has changed in the fields that we are revisioning.
Fixes: #7392 and #9843 props adamsilverstein.


git-svn-id: http://core.svn.wordpress.org/trunk@23414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-14 11:36:32 +00:00
Ryan Boren
353ef064ea Use microtime() instead of incrementors for last_changed to to avoid race conditions with cache evictions.
Props westi
fixes #23448


git-svn-id: http://core.svn.wordpress.org/trunk@23401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-11 18:08:14 +00:00
Sergey Biryukov
c569c15b6d Correct the documentation for _publish_post_hook(). Remove unused global declaration. props roulandf. fixes #23376.
git-svn-id: http://core.svn.wordpress.org/trunk@23387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-05 15:45:37 +00:00
Sergey Biryukov
6f00a2c1cc Sanitize post_author and comment_count as integer fields. props GeertDD. fixes #22324.
git-svn-id: http://core.svn.wordpress.org/trunk@23353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-28 04:17:05 +00:00
Ryan Boren
1b2b394a91 Avoid the appearance of a magic number.
Props nacin
see #23167


git-svn-id: http://core.svn.wordpress.org/trunk@23320 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-22 15:52:13 +00:00
Ryan Boren
48058dfb99 Explicitly set last_changed to 1 instead of the result of wp_cache_set(). Avoids ambiguity and works with cache backends that return void instead of boolean.
see #23167


git-svn-id: http://core.svn.wordpress.org/trunk@23319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-22 15:46:16 +00:00
Helen Hou-Sandí
b538d6163f Make sure .widefat border and background coloring only applies to tables. props MikeHansenMe. fixes #21936.
git-svn-id: http://core.svn.wordpress.org/trunk@23315 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-22 14:44:04 +00:00
Ryan Boren
1edf259b45 In get_pages(), cache queries to individual cache buckets instead of storing them in one cached array. Also, store post IDs instead of full objects. This reduces overall memory usage as well as the size of the cache buckets. Use incrementor style passive cache invalidation.
Props nprasath002
see #23167


git-svn-id: http://core.svn.wordpress.org/trunk@23300 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-15 17:32:35 +00:00
Peter Westwood
f683fc7677 Tighten our braces. Fixes #23118 props evansolomon.
git-svn-id: http://core.svn.wordpress.org/trunk@23265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-04 10:13:51 +00:00
Andrew Nacin
0d3d52a92a Always return arrays from get_post_ancestors(). Return an array when passed a value that evaluates to false.
props dannydehaan.
fixes #22882 for trunk.
Test: [1177/tests].



git-svn-id: http://core.svn.wordpress.org/trunk@23212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-27 15:48:18 +00:00
Andrew Nacin
8d52e9fc68 Always call get_post() in get_page_uri() to ensure we have a WP_Post object, which lazy-loads the ancestors this function requires.
props dd32
fixes #22883
Unit tests: [1175/tests]



git-svn-id: http://core.svn.wordpress.org/trunk@23208 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-27 15:26:05 +00:00
Andrew Nacin
f9d07a1928 Revert [21942] and have wp_publish_post() deal with the database directly. clean_post_cache() is now also called directly due to [21943].
fixes #22944 for trunk.
Unit tests: [1174/tests].

see #11399. see #21963.



git-svn-id: http://core.svn.wordpress.org/trunk@23206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-27 15:14:43 +00:00
Andrew Nacin
3097cb315b Do not save an initial revision for a post created through the auto-draft mechanism. Prevents a bogus revision, often with the title 'Auto Draft'. Restores pre-auto-draft behavior made obvious by XML-RPC's implementation of both auto-drafts and the subsequent wp.getRevisions method. fixes #22687. see #22686.
git-svn-id: http://core.svn.wordpress.org/trunk@22989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-03 06:28:28 +00:00
Ryan Boren
cef3bc6abb Map the create_posts post type cap to upload_files for attachments.
Props nacin
fixes #16714


git-svn-id: http://core.svn.wordpress.org/trunk@22921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-29 16:14:07 +00:00
Ryan Boren
b237423e72 Clear the object term relationships cache in wp_set_object_terms() rather than wp_set_post_terms(). This should be done lower in the stack than wp_set_post_terms().
Props batmoo
fixes #22560


git-svn-id: http://core.svn.wordpress.org/trunk@22878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-27 19:42:38 +00:00
Daryl Koopersmith
5b11aea8f5 Media: Dynamically generate attachment filters using get_post_mime_types().
Moves `get_post_mime_types()` from `wp-admin/includes/post.php` to `wp-includes/post.php`.

fixes #22514, see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-21 10:18:59 +00:00
Ryan Boren
a2edda4b6a Don't bail from get_the_terms() if the post type is not registed for the taxonomy. This can break back compat when add_post_type_support( 'page', 'post-formats' ) is called but register_taxonomy_for_object_type( 'postr_-format', 'page' ) is not.
Props SergeyBiryukov
fixes #22473


git-svn-id: http://core.svn.wordpress.org/trunk@22722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-20 18:31:06 +00:00
Andrew Nacin
2f77c7984b This should be a cache add, not a cache set. see #22503.
git-svn-id: http://core.svn.wordpress.org/trunk@22676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 08:39:52 +00:00
Andrew Nacin
a1dba4a709 Call wp_cache_set() with a group and then an expiration in wp_mime_type_icon(). fixes #22503. see #22186.
git-svn-id: http://core.svn.wordpress.org/trunk@22674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 08:31:43 +00:00
Ryan Boren
cc2ddb8421 Always return a raw filtered post object from WP_Post::get_instance().
Props kovshenin, scribu, ntm
fixes #22448


git-svn-id: http://core.svn.wordpress.org/trunk@22635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-17 15:14:48 +00:00
Andrew Nacin
c67a081816 Revert [22445]. see #20376. fixes #22389.
git-svn-id: http://core.svn.wordpress.org/trunk@22464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-08 03:30:56 +00:00
Andrew Nacin
8eb8948a2e Fix meta value querying in wp_list_pages(). props SergeyBiryukov. fixes #20376.
git-svn-id: http://core.svn.wordpress.org/trunk@22445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 21:48:38 +00:00
Andrew Nacin
c04587d409 Add a $public_only argument to count_many_users_posts() and get_posts_by_author_sql(). Defaults to false, and allows the counts to be returned for only public posts. props ryan, westi. fixes #21431.
git-svn-id: http://core.svn.wordpress.org/trunk@22386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-05 23:11:25 +00:00
Andrew Nacin
e04bdce3ca clean_post_cache() no longer calls itself recursively. see #11399.
git-svn-id: http://core.svn.wordpress.org/trunk@22357 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-02 16:13:53 +00:00
Ryan Boren
a550a6d489 Use the create_posts capability in more places.
In get_post_type_capabilities(), make sure create_posts reflects customizations to the edit_posts capability when create_posts is not specifically set.


git-svn-id: http://core.svn.wordpress.org/trunk@22291 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-24 22:15:43 +00:00
Ryan Boren
a316671b85 Don't wp_cache_add() stdClass objects in get_post() to avoid polluting the cache with incomplete or otherwise compromised objects.
Declare the core properties of WP_Pist as proper public properties and provide them with defaults.

Props wonderboymusic
fixes #22223


git-svn-id: http://core.svn.wordpress.org/trunk@22264 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-19 21:53:17 +00:00
Andrew Nacin
2cc408d09c Avoid queries in wp_unique_post_slug() for nav menu items. see #22189.
git-svn-id: http://core.svn.wordpress.org/trunk@22232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-15 14:13:57 +00:00
Andrew Nacin
57681dda7a Remove whitespace from around the WP_Post/get_post SQL string.
git-svn-id: http://core.svn.wordpress.org/trunk@22230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-15 03:08:43 +00:00
Andrew Nacin
fd56fd3563 Use wp_update_post() rather than wp_insert_post() in wp_publish_post() to avoid stomping of values like categories. props ericmann, fixes #22167. see #21963.
git-svn-id: http://core.svn.wordpress.org/trunk@22189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-11 17:36:59 +00:00
Andrew Nacin
ac6f57de76 Add post_type_labels_{$post_type} filter. props scribu. fixes #21948.
git-svn-id: http://core.svn.wordpress.org/trunk@22164 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-10 13:50:42 +00:00
Ryan Boren
ac0011a77c Make sure cache bucket is an array to avoid warning. see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@22163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-10 12:29:51 +00:00
Ryan Boren
faca571a3a Avoid 'Only variables should be assigned by reference' warning. Props wonderboymusic. see #21865
git-svn-id: http://core.svn.wordpress.org/trunk@22114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-04 18:21:47 +00:00
Ryan Boren
f8f60ac01b Introduce create_posts meta capability. Props scribu, nacin, casben79. see #16714
git-svn-id: http://core.svn.wordpress.org/trunk@22060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-27 15:33:19 +00:00
Ryan Boren
70edf4111b Fetch full terms for the post_category and tags_input queries and then wp_list_pluck() the desired fields. Fetching full terms primes the cache and reduces overall queries. Add cache invalidation to wp_set_post_terms(). Props scribu. see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21981 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-24 20:35:56 +00:00
Ryan Boren
bc3c170305 Don't add empty _wp_attached_file, _wp_attachment_metadata, _thumbnail_id meta to posts. Delete these fields when set to empty. Props SergeyBiryukov, Caspie. fixes #16391
git-svn-id: http://core.svn.wordpress.org/trunk@21967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-24 13:07:34 +00:00
Andrew Nacin
29b7d26ca5 Properly indent after [21952]. see #11399.
git-svn-id: http://core.svn.wordpress.org/trunk@21953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-22 16:21:06 +00:00
Andrew Nacin
a42ce2353a Stop cleaning the cache of a post's children. Ancestors are no longer cached against the post object, which means this kind of walking is unnecessary. It is also prohibitively expensive with large hierarchies.
We need to remove post_ancestors non-persistent caching for this. get_post_ancestors() can simply rely on the caching of get_post() instead. Previously, it was a direct query, hence the extra layers of caching and clearing.

Child cache clearing stays in wp_delete_post() as children get a new parent.

fixes #11399.



git-svn-id: http://core.svn.wordpress.org/trunk@21952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-22 15:55:02 +00:00
Andrew Nacin
33af30eb7f Use the regular post type UI for editing single media items (attachments).
* Attachments now go through post.php, edit_post(), the like, and have show_ui set to true.
 * Taxonomies attached to the media library now appear in the admin menu (if show_ui).
 * Editing, cropping, uploading, etc. is still very rough, but mostly functional.

API-wise:
 * New function: get_taxonomies_for_attachments(). Like get_taxonomies(), for taxonomies specifically registered against attachments.
 * Brings taxonomy support from the posts list table to the media list table. Expect them to converge soon.
 * wp_insert_attachment() now handles taxonomies like wp_insert_post(). Also expect them to converge soon.
 * New edit_form_after_title hook.

props helenyhou, ocean90. see #21391.



git-svn-id: http://core.svn.wordpress.org/trunk@21948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-21 22:52:54 +00:00
Andrew Nacin
5a362d3ace Call clean_post_cache() in wp_insert_post() after the manual query to change GUID. Remove the second call to clean_post_cache() previously done on the save_post hook. see #11399.
git-svn-id: http://core.svn.wordpress.org/trunk@21943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-21 18:52:15 +00:00
Andrew Nacin
a4831c82f0 Have wp_publish_post() wrap wp_insert_post() directly. see #11399.
git-svn-id: http://core.svn.wordpress.org/trunk@21942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-21 18:49:45 +00:00
Peter Westwood
fa8a509ff3 Posting: Improve the invalid date protection code based on feedback from nacin.
* Introduce a wp_checkdate() function with a single filter to centralise the code that validates dates.
 * Improve the error message
 * Correctly handle the return value of wp_insert_post which is not always a WP_Error on failure

Fixes #17180


git-svn-id: http://core.svn.wordpress.org/trunk@21922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-20 10:46:50 +00:00
Peter Westwood
c05f6dc6dd Posting: Make it much harder to create posts with invalid dates by enforcing the post date tests in the UI and the backend code.
Previously you could quite easily send a new post into the back of beyond by specifying an invalid date like the 30th Feb and this was very confusing.
Sometimes it would seem to work and sometimes the post would end up very far in the past - depending on the mysql version and other factors.

Fixes #17180 props jkudish.


git-svn-id: http://core.svn.wordpress.org/trunk@21921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-19 21:43:35 +00:00
Andrew Nacin
a7cd7c3ac7 Use wp_get_theme()->get_page_templates() rather than get_page_templates() in wp_insert_post(),
to allow page template setting on the frontend without a fatal error. fixes #21755.



git-svn-id: http://core.svn.wordpress.org/trunk@21847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-14 18:36:08 +00:00
Andrew Nacin
95c9cd1e6b Remove unused show_in_admin_all and single_view_cap from register_post_status(). props duck_. fixes #18972.
git-svn-id: http://core.svn.wordpress.org/trunk@21846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-14 18:02:23 +00:00
Andrew Nacin
07324a1f53 In get_page_by_path(), attempt to return an item that has the same post type before returning an attachment with the same name. props SergeyBiryukov. tests in [UT1021]. fixes #15665.
git-svn-id: http://core.svn.wordpress.org/trunk@21845 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-14 17:19:25 +00:00
Andrew Nacin
b65ceddeeb If update_post_caches() does not receive a post type, glean post types from the individual post objects, rather than assuming 'post'. fixes #20177.
git-svn-id: http://core.svn.wordpress.org/trunk@21844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-14 16:26:05 +00:00
Andrew Nacin
5bc021dad7 Allow supports => false to be passed to register_post_type() to disable the default title and editor.
An empty array may also disable all default features in the future.
Do not rely on this behavior: always specify title and editor if you want them.

props sc0ttkclark.
fixes #21586.



git-svn-id: http://core.svn.wordpress.org/trunk@21831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-13 17:02:39 +00:00
Andrew Nacin
bc6087bc98 Always return upload directory information from wp_upload_dir(), even if there is an error. Append the error to the array. see #19235.
git-svn-id: http://core.svn.wordpress.org/trunk@21822 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-11 22:06:49 +00:00
Andrew Nacin
9d204841ee Remove AtomPub from core.
* Will be replaced with http://wordpress.org/extend/plugins/atom-publishing-protocol/.
 * Introduces an action, xmlrpc_rsd_apis, to add APIs to xmlrpc.php?rsd.
 * Introduces support for 'error' being 403 and 50x in class-wp.php.
 * Removes 'Remote Publishing' from Writing Settings (see [21804]). Keeps the remote_publishing settings section.

DB version is bumped to generate the new wp-app rewrite rule and remove the old enable_app option.

props wonderboymusic.
fixes #21509.



git-svn-id: http://core.svn.wordpress.org/trunk@21818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-11 20:11:39 +00:00
Ryan Boren
f483a85676 Remove unnecessary return by refs. Props wonderboymusic. fixes #21839
git-svn-id: http://core.svn.wordpress.org/trunk@21792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-10 17:00:11 +00:00
Andrew Nacin
8a46609b03 Use wp_cache_add() in wp_mime_type_icon(). fixes #21835.
git-svn-id: http://core.svn.wordpress.org/trunk@21783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-07 21:10:43 +00:00
Daryl Koopersmith
50b120ad64 Ensure $post_id is defined in wp_mime_type_icon() to prevent notices when a valid mime type string is provided. see #21835.
git-svn-id: http://core.svn.wordpress.org/trunk@21782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-07 21:04:58 +00:00
Ryan Boren
cfb35a9d85 Use get_post() instead of global $post.
Make the $post argument to get_post() optional, defaulting to the current post in The Loop.

Props nacin
see #21309


git-svn-id: http://core.svn.wordpress.org/trunk@21735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-04 16:29:28 +00:00
Ryan Boren
16b01d701e Simplify return from WP_Post::__get() now that references are no longer returned. see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-29 13:42:11 +00:00
Ryan Boren
a43222bfaf Lose return ref from WP_Post::__get(). see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-29 13:23:54 +00:00
Ryan Boren
52b3f498e6 Add tags_input, page_template, and post_category get magic to WP_Post.
Deprecate get_post_to_edit() and wp_get_single_post().
Props scribu
see #21309


git-svn-id: http://core.svn.wordpress.org/trunk@21651 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-28 19:08:28 +00:00
Ryan Boren
2ea0626e5d Use switch_to_blog()/restore_current_blog() in get_blog_post() and get_blog_permalink(). Eliminate the duplicate caching in these functions. Return WP_Post from get_blog_post(). Update phpdoc. Remove global-posts cache invalidation. Props jondavidjohn fixes #21595
git-svn-id: http://core.svn.wordpress.org/trunk@21628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-27 16:22:45 +00:00
Ryan Boren
0352820e7b Remove typo in phpdoc. see #21309 Props TobiasBg
git-svn-id: http://core.svn.wordpress.org/trunk@21601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-23 21:15:40 +00:00
Ryan Boren
18a1783423 Update phpdoc for functions that return WP_Post. Soft deprecate get_page(). see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-23 20:34:41 +00:00
Ryan Boren
f56d8278bb Remove return ref from all calls to get_post()
Return WP_Post from get_default_post_to_edit()
Replace all calls to get_page() with get_post()
see #21309


git-svn-id: http://core.svn.wordpress.org/trunk@21597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-23 20:01:10 +00:00
Ryan Boren
d2ecd62b7f Remove references from get_post() and get_page().
Handle $GLOBALS['post'] containing stdClass instead of WP_Post.
Props nacin
see #21309


git-svn-id: http://core.svn.wordpress.org/trunk@21572 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-21 15:42:28 +00:00
Andrew Nacin
cc63fad8cb Return a variable reference from get_pages(). see [21559], see #21309, fixes #20756.
git-svn-id: http://core.svn.wordpress.org/trunk@21567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-20 23:43:04 +00:00
Ryan Boren
9377523bce Introduce WP_Post class. Clean up ancestors handling. Props scribu, toppa. fixes #10381 see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-20 19:47:52 +00:00
Ryan Boren
9dbb6a34f6 Reduce calls to sanitize_title_with_dashes in register_(post_type|taxonomy). Props ocean90. fixes #21600
git-svn-id: http://core.svn.wordpress.org/trunk@21553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-20 17:25:06 +00:00
Andrew Nacin
7a4fdb78e1 Always return a variable reference from get_pages(). props wonderboymusic, foxinni. fixes #20756.
git-svn-id: http://core.svn.wordpress.org/trunk@21550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-20 16:38:43 +00:00
duck_
2740918883 Remove unused arguments (hierarchical, _edit_link, capability_type) from register_post_status
Props scribu, simonwheatley. Fixes #18578, #18972.


git-svn-id: http://core.svn.wordpress.org/trunk@21302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-22 08:45:35 +00:00
markjaquith
c937101f27 Clear the get_pages cache whenever ANY hierarchical post type cache is cleared — not just Pages. fixes #21279
git-svn-id: http://core.svn.wordpress.org/trunk@21286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-20 04:35:51 +00:00
markjaquith
6a1d888ea5 Better image extension regexes, so we don't just grab the "jpe" from "jpeg" files in media_sideload_image(). props sivel. fixes #16693
git-svn-id: http://core.svn.wordpress.org/trunk@21219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-05 20:51:55 +00:00
nacin
60b88004a6 Allow wp_update_post() to accept the same second argument as wp_insert_post(), allowing for WP_Error return values on failure. props scribu, mikeschinkel. fixes #15036.
git-svn-id: http://core.svn.wordpress.org/trunk@21213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-05 19:21:57 +00:00
nacin
c00968bee0 Take the original slug passed into wp_unique_post_slug() and pass it to the wp_unique_post_slug filter. props johnbillion. fixes #20480.
git-svn-id: http://core.svn.wordpress.org/trunk@21177 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-29 13:57:02 +00:00
duck_
a2cf2fa988 get_post_stati() returns post statuses not types. Props jeremyfelt. Fixes #20664.
git-svn-id: http://core.svn.wordpress.org/trunk@20779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-13 07:41:47 +00:00
ryan
d58d5993b0 Collect intermediate images before deleting an attachment and its meta. Fixes thumbnail deletion. Props SergeyBiryukov. fixes #20658
git-svn-id: http://core.svn.wordpress.org/trunk@20770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-11 18:47:32 +00:00
ryan
f5366a2ccf Don't delete nav menu items when the user that owns them is deleted.
* Introduce delete_with_user flag to register_post_type
* Set delete_with_user to false for the nav_menu_item post type
* Set it to true for all other core post types
* If delete_with_user is not set, fallback to post_type_supports('author')

Props nacin
Fixes #16358


git-svn-id: http://core.svn.wordpress.org/trunk@20739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-08 17:01:50 +00:00
ryan
85781eaed2 phpdoc updates for register_post_type(). Props jeremyfelt. fixes #20622
git-svn-id: http://core.svn.wordpress.org/trunk@20734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-07 16:25:06 +00:00
ryan
ea65aae093 phpdoc fix for register_post_status(). Props yoavf. fixes #20616
git-svn-id: http://core.svn.wordpress.org/trunk@20726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-05 19:04:34 +00:00
nacin
0cac69f505 Return false in get_attached_file() when the file does not exist, rather than a path to the base uploads directory. props mikeschinkel. fixes #18855.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20613 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-27 16:08:58 +00:00
duck_
1e76fdfb4b Accept a post object in clean_post_cache(). Fixes #20486.
The post_type can then be accessed to properly clean the taxonomy relationships cache.
The full object is useful in situations when an ID might reference a post that has been
removed from the database (e.g. wp_delete_post()).


git-svn-id: http://svn.automattic.com/wordpress/trunk@20569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-23 22:04:35 +00:00
duck_
4523ec1333 Fix typo and terminology in Twenty Eleven's header template. Props JarretC. Fixes #20442.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20465 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-14 19:02:04 +00:00
ryan
27630a4286 Schedule auto-draft deletion from post-new.php instead of from admin.php. This provides better throttling for large multisite installs and reduces the risk of a delete avalanche.
fixes #19663


git-svn-id: http://svn.automattic.com/wordpress/trunk@20453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-12 18:49:48 +00:00
nacin
c7cf0927fc Use the metadata API rather than raw queries and direct do_action calls. see #20417.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20435 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-11 20:02:39 +00:00
ryan
baf681233f Pass post_type to clean_post_cache() instead of attempting to fetch a post object since the post may have been deleted.
Props leewillis77
see #19690


git-svn-id: http://svn.automattic.com/wordpress/trunk@20423 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-10 16:09:44 +00:00
nacin
0730535015 Introduce $wpdb->delete(). props justindgivens, scribu. fixes #18948.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-24 15:24:31 +00:00
westi
79ff94923e XMLRPC: Add new wp.getPostType and wp.getPostTypes apis. See #18436 props maxcutler, markoheijnen and nprasath002.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-23 17:53:14 +00:00
ryan
5b2274941d Don't generate a query when the all_page_ids cache is an empty array. An empty array is a valid cache value when no pages are present. Avoids a useless query for sites with no pages. Props andy. see #20236
git-svn-id: http://svn.automattic.com/wordpress/trunk@20216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-19 19:09:03 +00:00
duck_
848d75c4cb Use return value of update_post_meta() in set_post_thumbnail() instead of always returning true. Props webord. Fixes #20218.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-14 09:48:57 +00:00
ryan
6241238938 Call _get_post_ancestors() from get_post_ancestors() if the ancestors property is not set in the post object. Works around situations where ancestors is not set in the cached version of the post object. see #18536
git-svn-id: http://svn.automattic.com/wordpress/trunk@20171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-12 18:23:48 +00:00
westi
787d4acef5 XMLRPC: Expose the extended more text to XMLRPC clients from metaWeblog.getPost(). Fixes #10933 props koke, ericmann.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20156 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-08 12:50:21 +00:00
nacin
ae8af5d0dd Introduce get_page_template_slug( $id = null ) to return a page's template (like "showcase.php"). Returns false if post ID is not a page, and an empty string for the default page template. Use the function across core. props billerickson for initial patch. fixes #18750.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-02 18:56:54 +00:00
duck_
a395e06896 Reduce references to the $wp_rewrite global because it's no longer used or a wrapper function can be used instead. Fixes #14546.#14546.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 20:29:33 +00:00
ryan
cf4135d478 Update phpdoc for wp_mime_type_icon(). Props SergeyBiryukov, mitchoyoshitaka. fixes #16604
git-svn-id: http://svn.automattic.com/wordpress/trunk@19924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-14 18:12:01 +00:00
ryan
6aedd9d0f0 Split the main WP_Query posts query into two queries to avoid temp tables. Leverage cache to avoid second query in persistent cache environments. Props scribu, cheald, prettyboymp. see #18536
git-svn-id: http://svn.automattic.com/wordpress/trunk@19918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-14 15:09:35 +00:00
nacin
51cdc1719d Docs, see ##19882.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-10 22:49:56 +00:00
nacin
396a5b89e8 Allow get_post_meta() to be called with only a post ID, as get_metadata() handles this. props scribu, fixes #19882.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-10 22:42:54 +00:00
duck_
787dd48e8b Make get_post_custom() a wrapper of get_post_meta() so that it works when cache addition is suspended and to simplify it.
Props leewillis77 for the initial patch. Fixes #19708.


git-svn-id: http://svn.automattic.com/wordpress/trunk@19906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-10 22:00:37 +00:00
nacin
72c995441a Allow localized commas to be used as tag separators. see #7897.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-07 18:06:12 +00:00
duck_
2f4c545761 Use new $args parameter for (WP_Rewrite::)add_permastruct(). Fixes #16092.
Use array_intersect_key() to keep WP_Rewrite::$extra_permastructs free of unnecessary/unknown keys + values.


git-svn-id: http://svn.automattic.com/wordpress/trunk@19779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-28 21:00:59 +00:00
nacin
2e8a358541 s/parem/param/. props Latz. fixes #19823.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-24 21:52:49 +00:00
nacin
674196a2ef Args is an object, not an array. props duck_, aaroncampbell. see #19275.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-23 19:32:39 +00:00
nacin
61abfcd3c7 Add 'ep_mask' as an argument to the 'rewrite' array for register_post_type() and register_taxonomy(). Keeps 'permalink_epmask' compatible as an argument for post type registrations. Fixes endpoints for category and tag pages. fixes #19275.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-23 19:12:04 +00:00
duck_
fab149d81e Update hierarchy for all hierarchical post types when deleting a parent post, not just for pages. Fixes #19637.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-13 18:37:46 +00:00
ryan
4cf5450a81 Use wp_cache_add() instead of wp_cache_set() when priming the object term cache in update_object_term_cache(). Pass the real post_type to clean_object_term_cache() instead of hard-coding post. Call clean_object_term_cache() from clean_bookmark_cache(). Props leewillis77. fixes #19690
git-svn-id: http://svn.automattic.com/wordpress/trunk@19729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-11 21:26:18 +00:00
duck_
3c0d45d77c Rewrite rules don't need to be flushed on every page save/delete as they're no longer verbose. Fixes #19636.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-10 22:55:38 +00:00
duck_
81a7ad2c81 split was deprecated in PHP 5.3.0, so use explode instead. Props garyc40. Fixes #16325.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-09 21:20:51 +00:00
ryan
e3b46b25d3 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: http://svn.automattic.com/wordpress/trunk@19712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-08 17:01:11 +00:00
duck_
65b840b565 Fix mistakes in parameter documentation and add some missing param docs. See #19756.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-06 18:31:43 +00:00
ryan
616c35e71c One newline is enough.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-05 20:10:39 +00:00
ryan
3eaf083995 Introduce sanitize_trackback_urls(). Don't ping bad urls. Don't ping bad urls or save them to the DB. Props xknown, SergeyBiryukov. fixes #17560
git-svn-id: http://svn.automattic.com/wordpress/trunk@19675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-04 19:45:13 +00:00
ryan
07ff8b216b Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: http://svn.automattic.com/wordpress/trunk@19593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-13 23:45:31 +00:00
dd32
c85525aece Switch to sanitize_title_for_query() for Query sanitization (allows for pre-3.3 page slugs to be viewable), Don't update page slugs to new slug-types when the slug is not being changed, Don't issue a XHR if the page slug hasn't changed. Group effort props xknown, markjaquith, nacin. See #19292
git-svn-id: http://svn.automattic.com/wordpress/trunk@19444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-24 00:20:21 +00:00
nacin
d61b1474f9 Only enforce content/title/excerpt requirement in wp_insert_post() if the post type supports all three. Add a filter to allow this to be modified. fixes #18713.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-15 21:19:29 +00:00
duck_
d17f4409c3 Don't pass $post_type as get_page()'s $filter argument. Copy-and-paste error. Removal improves get_page_by_path() performance dramatically by stopping sanitize_post() being called. Fixes #19175.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-14 21:32:56 +00:00
dd32
5a026c389b Fix typo in [19231]. See #17579
git-svn-id: http://svn.automattic.com/wordpress/trunk@19234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-09 22:13:35 +00:00
nacin
04c38f3313 Check post type and bail earlier in wp_get_attachment_url(). props mitchoyoshitaka, fixes #17579.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-09 19:20:33 +00:00
nacin
d040cc1347 Don't set post_type QV in _post_format_request() when we're in the admin. props ethitter. fixes #18475.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-06 21:15:23 +00:00
duck_
aeb49fb7be Return full WHERE clause from get_posts_by_author_sql() if the post type isn't registerd. Fixes SQL sytax on users list when 'post' is unregistered. Fixes #19116.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-02 17:06:34 +00:00
ryan
28b1b4763d Avoid E_STRICT notices. see #18975
git-svn-id: http://svn.automattic.com/wordpress/trunk@19094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-31 19:38:46 +00:00
ryan
c3c6a3721f Fix notices and logic errors in get_page_by_path(). Props duck_. see #17670
git-svn-id: http://svn.automattic.com/wordpress/trunk@19075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-28 19:32:19 +00:00
ryan
62afab8db3 Pinking shears
git-svn-id: http://svn.automattic.com/wordpress/trunk@19054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-24 19:13:23 +00:00
nacin
00a31d6d19 Correct docs for get_post_field(). props JustinSainton, fixes #19025.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-21 17:13:26 +00:00
ryan
fca9f2e2e3 In wp_trash_post(), rename the trash_post action to wp_trash_post to avoid collision with the wp_transition_post_status() trash_post state transition. Props SergeyBiryukov. fixes #15628
git-svn-id: http://svn.automattic.com/wordpress/trunk@18974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-14 18:39:31 +00:00
ryan
0370bda8bc Count only published posts when updating term counts. Fire term count updates on transition_post_status. Props joehoyle. see #17548
git-svn-id: http://svn.automattic.com/wordpress/trunk@18932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-10 20:52:44 +00:00
ryan
d7a17b96e9 Avoid refetching a post in get_post() when passed a post object that has already been raw sanitized. Clean up sanitize loop. Props scribu. fixes #18822
git-svn-id: http://svn.automattic.com/wordpress/trunk@18846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-30 19:06:18 +00:00
ryan
e46e579ce5 Restore sorting by post_name in get_pages(). Props SergeyBiryukov. fixes #18805
git-svn-id: http://svn.automattic.com/wordpress/trunk@18845 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-30 18:12:14 +00:00
westi
b5a3362c70 Fire an action when a post type or taxonomy is registered so plugins can react. Fixes #18802 props simonwheatley.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-30 09:53:35 +00:00
azaozz
75432d53b0 Clean up remnants from having negative Post_IDs, props markjaquith, fixes #18235
git-svn-id: http://svn.automattic.com/wordpress/trunk@18823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-29 21:47:52 +00:00
nacin
f4c5d43326 Revert [18783], as it breaks term relationship counts for attachment taxonomies. see #17548.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-29 05:29:20 +00:00
ryan
d187cf2559 Count only published posts when updating term counts. Fire term count updates on transition_post_status. Props joehoyle. fixes #17548
git-svn-id: http://svn.automattic.com/wordpress/trunk@18783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-26 22:24:46 +00:00
nacin
9f216ad715 delete_post_thumbnail(). props CoenJacobs, duck_. fixes #17895.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-24 19:31:38 +00:00
duck_
4a6513185a Documentation fixes. See #18560.
- Add missing parameters
 - Add missing @param data types
 - s/format_where/where_format/


git-svn-id: http://svn.automattic.com/wordpress/trunk@18753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-22 12:02:31 +00:00
ryan
23db619491 Don't send page slugs through prepare() to avoid breaking octets in i18n page slugs. Props SergeyBiryukov. see #10249 #166687
git-svn-id: http://svn.automattic.com/wordpress/trunk@18652 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-08 17:17:17 +00:00
duck_
2f51b9be0d Fix typos in documentation (wp-includes/[i-z]). See #18560.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-05 19:08:15 +00:00
markjaquith
31a016614d Cast to array in get_page_by_path() foreach
git-svn-id: http://svn.automattic.com/wordpress/trunk@18627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-31 06:46:16 +00:00
dd32
f1ac48873b Display 'Edit Media' instead of 'Edit Post' for Attachments/Media in the admin bar. Props johnbillion. Fixes #18529
git-svn-id: http://svn.automattic.com/wordpress/trunk@18613 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-28 03:39:06 +00:00
westi
35838967a7 Add a general filter to wp_unique_post_slug to allow for full customisation of the uniqueness functionality. Fixes #14111.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-13 21:00:24 +00:00
markjaquith
4a610eaa7b Eliminate verbose rewrite rules for ambiguous rewrite structures, resulting in massive performance gains. props andy, otto42, duck_. Nice work everyone! see #16687
git-svn-id: http://svn.automattic.com/wordpress/trunk@18541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-12 01:55:08 +00:00
ryan
ec4ccf2900 Deprecate get_userdatabylogin() and get_user_by_email(). Props scribu. fixes #18333
git-svn-id: http://svn.automattic.com/wordpress/trunk@18513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-05 16:57:31 +00:00
ryan
24d480d088 Turn delete_meta() , get_post_meta_by_id(), update_meta(), delete_post_meta_by_key() into wrappers around the metadata API. Add back compat *_postmeta actions to metadata API. Props jgadbois. see #18196
git-svn-id: http://svn.automattic.com/wordpress/trunk@18500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-03 16:48:37 +00:00
ryan
496081f898 phpdoc for all_items and menu_name. Props ocean90. fixes #18036
git-svn-id: http://svn.automattic.com/wordpress/trunk@18472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-07-26 21:31:36 +00:00
ryan
2d148f51de Fix CPT rewrite generation when turning on permalinks. Props andy. see #18040 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@18443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-07-15 15:49:42 +00:00
ryan
7a466b9ed9 Unset filter when inserting/updating posts. For trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@18367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-28 21:46:18 +00:00
azaozz
f2abed5956 Fix phpdoc for register_post_status(), props aaroncampbell, fixes #17900
git-svn-id: http://svn.automattic.com/wordpress/trunk@18352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-27 21:22:31 +00:00
ryan
08b6aa116e Sanitize sort_column and sort_order in get_pages(). Escape search_term in WP_User_Search. Cast blog_id to int in get_blog_prefix(). Props duck_
git-svn-id: http://svn.automattic.com/wordpress/trunk@18350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-27 20:47:04 +00:00
nacin
2d54db5d7c Introduce name_admin_bar label and the show_in_admin_bar (Add New menu) argument for post types. Allows for proper translations of these strings and provides for consolidated logic. fixes #16406.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-11 02:20:18 +00:00
markjaquith
856c2742ca Fix mistaken use of publicly_queryable when public was what was intended. props nacin. fixes #17040
git-svn-id: http://svn.automattic.com/wordpress/trunk@18234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-10 17:02:03 +00:00
westi
4360343656 Only show Comments are Closed when they are supported.
Tidy up the logic to be clearer.
Mark attachements as supporting comments.
Fixes #17568 props duck_

git-svn-id: http://svn.automattic.com/wordpress/trunk@18211 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-09 11:12:39 +00:00
ryan
7b1a753fc9 Use array_combine() to avoid a hard-coded copy of the post format slugs. Props mfields. fixes #17576
git-svn-id: http://svn.automattic.com/wordpress/trunk@18083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-31 19:52:38 +00:00
ryan
b188576030 phpdoc typo fix. Props Caspie. fixes #17616
git-svn-id: http://svn.automattic.com/wordpress/trunk@18080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-31 15:23:21 +00:00
ryan
c1bb49bb55 Rename duplicate delete_post and deleted_post actions to before_delete_post and after_delete_post. Props scribu. fixes #13731
git-svn-id: http://svn.automattic.com/wordpress/trunk@18012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-23 23:43:14 +00:00
ryan
2cfb1592f0 Mark import attachments as private. Schedule job to delete old import attachments. Introduce attachment context.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-22 23:25:28 +00:00
nacin
dfdc7d22a9 Allow get_pages() to take multiple post statuses. see #8592.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-12 03:53:46 +00:00
markjaquith
301be4eeef Rename submenus to not clash with top level menus. Introduce all_items CPT string, defaulting to menu_name. fixes #17378
git-svn-id: http://svn.automattic.com/wordpress/trunk@17864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-11 20:09:28 +00:00
nacin
9cb6e158fc Switch from Panel/SubPanel to Screen in inline documentation and Codex links. props michaelh, fixes #17265.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-28 15:24:49 +00:00