Ticket #8805: 8805.3.diff
| File 8805.3.diff, 15.6 KB (added by CharlesClarkson, 3 years ago) |
|---|
-
wp-includes/post.php
417 417 * @uses $wpdb 418 418 * 419 419 * @param int $post_id Post ID to change post type. Not actually optional. 420 * @param string $post_type Optional, default is post. Supported values are 'post' or 'page' to name a few. 420 * @param string $post_type Optional, default is post. Supported values are 'post' or 'page' to 421 * name a few. 421 422 * @return int Amount of rows changed. Should be 1 for success and 0 for failure. 422 423 */ 423 424 function set_post_type( $post_id = 0, $post_type = 'post' ) { … … 456 457 * @uses WP_Query::query() See for more default arguments and information. 457 458 * @link http://codex.wordpress.org/Template_Tags/get_posts 458 459 * 459 * @param array $args Optional. Override defaults.460 * @param array $args Optional. Overrides defaults. 460 461 * @return array List of posts. 461 462 */ 462 463 function get_posts($args = null) { … … 592 593 * @param int $post_id Post ID. 593 594 * @param string $key The meta key to retrieve. 594 595 * @param bool $single Whether to return a single value. 595 * @return mixed Will be an array if $single is false. Will be value of meta data field if $single is true. 596 * @return mixed Will be an array if $single is false. Will be value of meta data field if $single 597 * is true. 596 598 */ 597 599 function get_post_meta($post_id, $key, $single = false) { 598 600 if ( !$key ) … … 827 829 /** 828 830 * Sanitize post field based on context. 829 831 * 830 * Possible context values are: raw, edit, db, attribute, js, and display. The 831 * display context is used by default. 832 * Possible context values are: 'raw', 'edit', 'db', 'display', 'attribute' and 'js'. The 833 * 'display' context is used by default. 'attribute' and 'js' contexts are treated like 'display' 834 * when calling filters. 832 835 * 833 836 * @since 2.3.0 837 * @uses apply_filters() Calls 'edit_$field' and '${field_no_prefix}_edit_pre' passing $value and 838 * $post_id if $context == 'edit' and field name prefix == 'post_'. 834 839 * 840 * @uses apply_filters() Calls 'edit_post_$field' passing $value and $post_id if $context == 'db'. 841 * @uses apply_filters() Calls 'pre_$field' passing $value if $context == 'db' and field name prefix == 'post_'. 842 * @uses apply_filters() Calls '${field}_pre' passing $value if $context == 'db' and field name prefix != 'post_'. 843 * 844 * @uses apply_filters() Calls '$field' passing $value, $post_id and $context if $context == anything 845 * other than 'raw', 'edit' and 'db' and field name prefix == 'post_'. 846 * @uses apply_filters() Calls 'post_$field' passing $value if $context == anything other than 'raw', 847 * 'edit' and 'db' and field name prefix != 'post_'. 848 * 835 849 * @param string $field The Post Object field name. 836 850 * @param mixed $value The Post Object value. 837 851 * @param int $post_id Post ID. 838 * @param string $context How to sanitize post fields. 852 * @param string $context How to sanitize post fields. Looks for 'raw', 'edit', 'db', 'display', 853 * 'attribute' and 'js'. 839 854 * @return mixed Sanitized value. 840 855 */ 841 856 function sanitize_post_field($field, $value, $post_id, $context) { … … 1031 1046 * 1032 1047 * @since 2.5.0 1033 1048 * 1034 * @param string|array $wildcard_mime_types e.g. audio/mpeg or image (same as image/*) or flash (same as *flash*) 1049 * @param string|array $wildcard_mime_types e.g. audio/mpeg or image (same as image/*) or 1050 * flash (same as *flash*). 1035 1051 * @param string|array $real_mime_types post_mime_type values 1036 1052 * @return array array(wildcard=>array(real types)) 1037 1053 */ … … 1111 1127 * This includes comments, post meta fields, and terms associated with the post. 1112 1128 * 1113 1129 * @since 1.0.0 1114 * @uses do_action() Calls 'deleted_post' hook on post ID. 1130 * @uses do_action() on 'delete_post' before deletion unless post type is 'attachment'. 1131 * @uses do_action() on 'deleted_post' after deletion unless post type is 'attachment'. 1132 * @uses wp_delete_attachment() if post type is 'attachment'. 1115 1133 * 1116 1134 * @param int $postid Post ID. 1117 * @return mixed 1135 * @return mixed False on failure 1118 1136 */ 1119 1137 function wp_delete_post($postid = 0) { 1120 1138 global $wpdb, $wp_rewrite; … … 1212 1230 * Retrieve the tags for a post. 1213 1231 * 1214 1232 * There is only one default for this function, called 'fields' and by default 1215 * is set to 'all'. There are other defaults that can be overrid ein1233 * is set to 'all'. There are other defaults that can be overridden in 1216 1234 * {@link wp_get_object_terms()}. 1217 1235 * 1218 1236 * @package WordPress … … 1233 1251 * Retrieve the terms for a post. 1234 1252 * 1235 1253 * There is only one default for this function, called 'fields' and by default 1236 * is set to 'all'. There are other defaults that can be overrid ein1254 * is set to 'all'. There are other defaults that can be overridden in 1237 1255 * {@link wp_get_object_terms()}. 1238 1256 * 1239 1257 * @package WordPress … … 1322 1340 * setting the value for 'comment_status' key. 1323 1341 * 1324 1342 * The defaults for the parameter $postarr are: 1325 * 'post_status' - Default is 'draft'. 1326 * 'post_type' - Default is 'post'. 1327 * 'post_author' - Default is current user ID. The ID of the user, who added 1328 * the post. 1329 * 'ping_status' - Default is the value in default ping status option. 1330 * Whether the attachment can accept pings. 1331 * 'post_parent' - Default is 0. Set this for the post it belongs to, if 1332 * any. 1333 * 'menu_order' - Default is 0. The order it is displayed. 1334 * 'to_ping' - Whether to ping. 1335 * 'pinged' - Default is empty string. 1336 * 'post_password' - Default is empty string. The password to access the 1337 * attachment. 1338 * 'guid' - Global Unique ID for referencing the attachment. 1343 * 'post_status' - Default is 'draft'. 1344 * 'post_type' - Default is 'post'. 1345 * 'post_author' - Default is current user ID ($user_ID). The ID of the user who added the post. 1346 * 'ping_status' - Default is the value in 'default_ping_status' option. 1347 * Whether the attachment can accept pings. 1348 * 'post_parent' - Default is 0. Set this for the post it belongs to, if any. 1349 * 'menu_order' - Default is 0. The order it is displayed. 1350 * 'to_ping' - Whether to ping. 1351 * 'pinged' - Default is empty string. 1352 * 'post_password' - Default is empty string. The password to access the attachment. 1353 * 'guid' - Global Unique ID for referencing the attachment. 1339 1354 * 'post_content_filtered' - Post content filtered. 1340 * 'post_excerpt' - Post excerpt.1355 * 'post_excerpt' - Post excerpt. 1341 1356 * 1342 1357 * @since 1.0.0 1358 * @link http://core.trac.wordpress.org/ticket/9084 Bug report on 'wp_insert_post_data' filter. 1343 1359 * @uses $wpdb 1344 1360 * @uses $wp_rewrite 1345 1361 * @uses $user_ID 1346 1362 * 1347 * @param array $postarr Optional. Override defaults. 1363 * @uses do_action() Calls 'pre_post_update' on post ID if this is an update. 1364 * @uses do_action() Calls 'edit_post' action on post ID and post data if this is an update. 1365 * @uses do_action() Calls 'save_post' and 'wp_insert_post' on post id and post data just before 1366 * returning. 1367 * 1368 * @uses apply_filters() Calls 'wp_insert_post_data' passing $data, $postarr prior to database 1369 * update or insert. 1370 * @uses wp_transition_post_status() 1371 * 1372 * @param array $postarr Optional. Overrides defaults. 1348 1373 * @param bool $wp_error Optional. Allow return of WP_Error on failure. 1349 1374 * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success. 1350 1375 */ … … 1794 1819 * Calls hooks to transition post status. If the new post status is not the same 1795 1820 * as the previous post status, then two hooks will be ran, the first is 1796 1821 * 'transition_post_status' with new status, old status, and post data. The 1797 * next action called is 'OLDSTATUS_to_NEWSTATUS' the NEWSTATUSis the1798 * $new_status parameter and the OLDSTATUSis $old_status parameter; it has the1822 * next action called is 'OLDSTATUS_to_NEWSTATUS' the 'NEWSTATUS' is the 1823 * $new_status parameter and the 'OLDSTATUS' is $old_status parameter; it has the 1799 1824 * post data. 1800 1825 * 1801 1826 * The final action will run whether or not the post statuses are the same. The 1802 * action is named 'NEWSTATUS_POSTTYPE', NEWSTATUSis from the $new_status1803 * parameter and POSTTYPEis post_type post data.1827 * action is named 'NEWSTATUS_POSTTYPE', 'NEWSTATUS' is from the $new_status 1828 * parameter and 'POSTTYPE' is post_type post data. 1804 1829 * 1805 1830 * @since 2.3.0 1831 * @link http://codex.wordpress.org/Post_Status_Transitions 1806 1832 * 1833 * @uses do_action() Calls 'transition_post_status' on $new_status, $old_status and 1834 * $post if there is a status change. 1835 * @uses do_action() Calls '${old_status}_to_$new_status' on $post if there is a status change. 1836 * @uses do_action() Calls '${new_status}_$post->post_type' on post ID and $post. 1837 * 1807 1838 * @param string $new_status Transition to this post status. 1808 1839 * @param string $old_status Previous post status. 1809 1840 * @param object $post Post data. 1810 1841 */ 1811 function wp_transition_post_status($new_status, $old_status, $post) {1842 function wp_transition_post_status($new_status, $old_status, $post) { 1812 1843 if ( $new_status != $old_status ) { 1813 1844 do_action('transition_post_status', $new_status, $old_status, $post); 1814 1845 do_action("${old_status}_to_$new_status", $post); … … 2073 2104 /** 2074 2105 * Order the pages with children under parents in a flat list. 2075 2106 * 2076 * Fetches the pages returned as a FLAT list, but arranged in order of their2077 * hierarchy, i.e., child parents immediately follow their parents.2078 *2079 2107 * @since 2.0.0 2080 2108 * 2081 2109 * @param array $posts Posts array. 2082 2110 * @param int $parent Parent page ID. 2083 * @return array 2111 * @return array A list arranged by hierarchy. Children immediately follow their parents. 2084 2112 */ 2085 2113 function get_page_hierarchy($posts, $parent = 0) { 2086 2114 $result = array ( ); … … 2320 2348 * setting the value for the 'comment_status' key. 2321 2349 * 2322 2350 * The $object parameter can have the following: 2323 * 'post_status' - Default is 'draft'. Can not be override, set the same as 2324 * parent post. 2325 * 'post_type' - Default is 'post', will be set to attachment. Can not 2326 * override. 2327 * 'post_author' - Default is current user ID. The ID of the user, who added 2328 * the attachment. 2329 * 'ping_status' - Default is the value in default ping status option. 2330 * Whether the attachment can accept pings. 2331 * 'post_parent' - Default is 0. Can use $parent parameter or set this for 2332 * the post it belongs to, if any. 2333 * 'menu_order' - Default is 0. The order it is displayed. 2334 * 'to_ping' - Whether to ping. 2335 * 'pinged' - Default is empty string. 2336 * 'post_password' - Default is empty string. The password to access the 2337 * attachment. 2338 * 'guid' - Global Unique ID for referencing the attachment. 2351 * 'post_status' - Default is 'draft'. Can not be overridden, set the same as parent post. 2352 * 'post_type' - Default is 'post', will be set to attachment. Can not override. 2353 * 'post_author' - Default is current user ID. The ID of the user, who added the attachment. 2354 * 'ping_status' - Default is the value in default ping status option. Whether the attachment 2355 * can accept pings. 2356 * 'post_parent' - Default is 0. Can use $parent parameter or set this for the post it belongs 2357 * to, if any. 2358 * 'menu_order' - Default is 0. The order it is displayed. 2359 * 'to_ping' - Whether to ping. 2360 * 'pinged' - Default is empty string. 2361 * 'post_password' - Default is empty string. The password to access the attachment. 2362 * 'guid' - Global Unique ID for referencing the attachment. 2339 2363 * 'post_content_filtered' - Attachment post content filtered. 2340 * 'post_excerpt' - Attachment excerpt.2364 * 'post_excerpt' - Attachment excerpt. 2341 2365 * 2342 2366 * @since 2.0.0 2343 2367 * @uses $wpdb 2344 2368 * @uses $user_ID 2369 * @uses do_action() Calls 'edit_attachment' on $post_ID if this is an update. 2370 * @uses do_action() Calls 'add_attachment' on $post_ID if this is not an update. 2345 2371 * 2346 2372 * @param string|array $object Arguments to override defaults. 2347 2373 * @param string $file Optional filename. … … 2996 3022 * Cleaning means delete from the cache of the post. Will call to clean the term 2997 3023 * object cache associated with the post ID. 2998 3024 * 3025 * clean_post_cache() will call itself recursively for each child post. 3026 * 3027 * This function not run if $_wp_suspend_cache_invalidation is not empty. See 3028 * wp_suspend_cache_invalidation(). 3029 * 2999 3030 * @package WordPress 3000 3031 * @subpackage Cache 3001 3032 * @since 2.0.0 3002 3033 * 3003 * @uses do_action() Will call the 'clean_post_cache' hook action.3034 * @uses do_action() Calls 'clean_post_cache' on $id before adding children (if any). 3004 3035 * 3005 3036 * @param int $id The Post ID in the cache to clean 3006 3037 */ … … 3175 3206 * @since 2.3.0 3176 3207 * @access private 3177 3208 * @uses $wpdb 3209 * @uses do_action() Calls 'private_to_published' on post ID if this is a 'private_to_published' call. 3210 * @uses wp_clear_scheduled_hook() with 'publish_future_post' and post ID. 3178 3211 * 3179 3212 * @param string $new_status New post status 3180 3213 * @param string $old_status Previous post status … … 3200 3233 * The $post properties used and must exist are 'ID' and 'post_date_gmt'. 3201 3234 * 3202 3235 * @since 2.3.0 3236 * @access private 3203 3237 * 3204 3238 * @param int $deprecated Not Used. Can be set to null. 3205 3239 * @param object $post Object type containing the post information … … 3213 3247 * Hook to schedule pings and enclosures when a post is published. 3214 3248 * 3215 3249 * @since 2.3.0 3250 * @access private 3216 3251 * @uses $wpdb 3217 * @uses XMLRPC_REQUEST 3218 * @uses APP_REQUEST 3219 * @uses do_action Calls 'xmlprc_publish_post' action if XMLRPC_REQUEST is defined. Calls 'app_publish_post' 3220 * action if APP_REQUEST is defined. 3252 * @uses XMLRPC_REQUEST and APP_REQUEST constants. 3253 * @uses do_action() Calls 'xmlprc_publish_post' on post ID if XMLRPC_REQUEST is defined. 3254 * @uses do_action() Calls 'app_publish_post' on post ID if APP_REQUEST is defined. 3221 3255 * 3222 3256 * @param int $post_id The ID in the database table of the post being published 3223 3257 */ … … 3252 3286 * property. 3253 3287 * 3254 3288 * @since 2.3.0 3289 * @access private 3255 3290 * @uses $wp_rewrite Flushes Rewrite Rules. 3256 3291 * 3257 3292 * @param int $post_id The ID in the database table for the $post … … 3282 3317 * complete. The post parent will be an ancestor and the parent of the post 3283 3318 * parent will be an ancestor. There will only be two ancestors at the most. 3284 3319 * 3320 * @since unknown 3285 3321 * @access private 3286 * @since unknown3287 3322 * @uses $wpdb 3288 3323 * 3289 3324 * @param object $_post Post data. … … 3319 3354 * @subpackage Post_Revisions 3320 3355 * @since 2.6.0 3321 3356 * @access private 3357 * @uses apply_filters() Calls '_wp_post_revision_fields' on 'title', 'content' and 'excerpt' fields. 3322 3358 * 3323 3359 * @param array $post Optional a post array to be processed for insertion as a post revision. 3324 3360 * @param bool $autosave optional Is the revision an autosave? … … 3573 3609 /** 3574 3610 * Restores a post to the specified revision. 3575 3611 * 3576 * Can restore a past using all fields of the post revision, or only selected 3577 * fields. 3612 * Can restore a past revision using all fields of the post revision, or only selected fields. 3578 3613 * 3579 3614 * @package WordPress 3580 3615 * @subpackage Post_Revisions … … 3582 3617 * 3583 3618 * @uses wp_get_post_revision() 3584 3619 * @uses wp_update_post() 3620 * @uses do_action() Calls 'wp_restore_post_revision' on post ID and revision ID if wp_update_post() 3621 * is successful. 3585 3622 * 3586 3623 * @param int|object $revision_id Revision ID or revision object. 3587 * @param array $fields Optional. What fields to restore from. Defaults to all.3624 * @param array $fields Optional. What fields to restore from. Defaults to all. 3588 3625 * @return mixed Null if error, false if no fields to restore, (int) post ID if success. 3589 3626 */ 3590 3627 function wp_restore_post_revision( $revision_id, $fields = null ) {
