Changeset 53715
- Timestamp:
- 07/18/2022 05:35:51 PM (2 years ago)
- Location:
- trunk/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/post.php
r53559 r53715 1377 1377 * @since 2.5.0 1378 1378 * 1379 * @param int|WP_Post $ idPost ID or post object.1379 * @param int|WP_Post $post Post ID or post object. 1380 1380 * @param string|null $title Optional. Title to override the post's current title 1381 1381 * when generating the post name. Default null. … … 1388 1388 * } 1389 1389 */ 1390 function get_sample_permalink( $id, $title = null, $name = null ) { 1391 $post = get_post( $id ); 1390 function get_sample_permalink( $post, $title = null, $name = null ) { 1391 $post = get_post( $post ); 1392 1392 1393 if ( ! $post ) { 1393 1394 return array( '', '' ); … … 1469 1470 * @since 2.5.0 1470 1471 * 1471 * @param int|WP_Post $ idPost ID or post object.1472 * @param int|WP_Post $post Post ID or post object. 1472 1473 * @param string|null $new_title Optional. New title. Default null. 1473 1474 * @param string|null $new_slug Optional. New slug. Default null. 1474 1475 * @return string The HTML of the sample permalink slug editor. 1475 1476 */ 1476 function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { 1477 $post = get_post( $id ); 1477 function get_sample_permalink_html( $post, $new_title = null, $new_slug = null ) { 1478 $post = get_post( $post ); 1479 1478 1480 if ( ! $post ) { 1479 1481 return ''; … … 1512 1514 // Encourage a pretty permalink setting. 1513 1515 if ( ! get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) 1514 && ! ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $ id)1516 && ! ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) 1515 1517 ) { 1516 1518 $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small">' . __( 'Change Permalink Structure' ) . "</a></span>\n"; … … 1629 1631 * @since 2.5.0 1630 1632 * 1631 * @param int|WP_Post $post _idID or object of the post to check for editing.1633 * @param int|WP_Post $post ID or object of the post to check for editing. 1632 1634 * @return int|false ID of the user with lock. False if the post does not exist, post is not locked, 1633 1635 * the user with lock does not exist, or the post is locked by current user. 1634 1636 */ 1635 function wp_check_post_lock( $post_id ) { 1636 $post = get_post( $post_id ); 1637 function wp_check_post_lock( $post ) { 1638 $post = get_post( $post ); 1639 1637 1640 if ( ! $post ) { 1638 1641 return false; … … 1640 1643 1641 1644 $lock = get_post_meta( $post->ID, '_edit_lock', true ); 1645 1642 1646 if ( ! $lock ) { 1643 1647 return false; … … 1667 1671 * @since 2.5.0 1668 1672 * 1669 * @param int|WP_Post $post _idID or object of the post being edited.1673 * @param int|WP_Post $post ID or object of the post being edited. 1670 1674 * @return array|false { 1671 1675 * Array of the lock time and user ID. False if the post does not exist, or there … … 1676 1680 * } 1677 1681 */ 1678 function wp_set_post_lock( $post_id ) { 1679 $post = get_post( $post_id ); 1682 function wp_set_post_lock( $post ) { 1683 $post = get_post( $post ); 1684 1680 1685 if ( ! $post ) { 1681 1686 return false; … … 1683 1688 1684 1689 $user_id = get_current_user_id(); 1690 1685 1691 if ( 0 == $user_id ) { 1686 1692 return false; … … 1702 1708 function _admin_notice_post_locked() { 1703 1709 $post = get_post(); 1710 1704 1711 if ( ! $post ) { 1705 1712 return; … … 1708 1715 $user = null; 1709 1716 $user_id = wp_check_post_lock( $post->ID ); 1717 1710 1718 if ( $user_id ) { 1711 1719 $user = get_userdata( $user_id ); … … 1937 1945 1938 1946 $post = get_post( $post_ID ); 1947 1939 1948 if ( ! $post ) { 1940 1949 wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); -
trunk/src/wp-includes/category-template.php
r53543 r53715 91 91 * 92 92 * @since 3.1.0 93 * @since 4.4.0 Added `$post_id` parameter.93 * @since 4.4.0 Added the `$post_id` parameter. 94 94 * 95 95 * @param WP_Term[] $categories An array of categories to return for the post. 96 * @param int|false $post_id ID of the post.96 * @param int|false $post_id The post ID. 97 97 */ 98 98 return apply_filters( 'get_the_categories', $categories, $post_id ); … … 134 134 * @param string $separator Optional. Separator between the categories. By default, the links are placed 135 135 * in an unordered list. An empty string will result in the default behavior. 136 * @param string $parents Optional. How to display the parents. 137 * @param int $post_id Optional. Post ID to retrieve categories. 136 * @param string $parents Optional. How to display the parents. Accepts 'multiple', 'single', or empty. 137 * Default empty string. 138 * @param int $post_id Optional. ID of the post to retrieve categories for. Defaults to the current post. 138 139 * @return string Category list for a post. 139 140 */ … … 152 153 * 153 154 * @param WP_Term[] $categories An array of the post's categories. 154 * @param int| bool $post_id ID of the post we're retrievingcategories for.155 * When `false`, we assumethe current post in the loop.155 * @param int|false $post_id ID of the post to retrieve categories for. 156 * When `false`, defaults to the current post in the loop. 156 157 */ 157 158 $categories = apply_filters( 'the_category_list', get_the_category( $post_id ), $post_id ); … … 251 252 * @param int|string|int[]|string[] $category Category ID, name, slug, or array of such 252 253 * to check against. 253 * @param int| object $post Optional. Post to check instead ofthe current post.254 * @param int|WP_Post $post Optional. Post to check. Defaults to the current post. 254 255 * @return bool True if the current post is in any of the given categories. 255 256 */ … … 269 270 * @param string $separator Optional. Separator between the categories. By default, the links are placed 270 271 * in an unordered list. An empty string will result in the default behavior. 271 * @param string $parents Optional. How to display the parents. 272 * @param int $post_id Optional. Post ID to retrieve categories. 272 * @param string $parents Optional. How to display the parents. Accepts 'multiple', 'single', or empty. 273 * Default empty string. 274 * @param int $post_id Optional. ID of the post to retrieve categories for. Defaults to the current post. 273 275 */ 274 276 function the_category( $separator = '', $parents = '', $post_id = false ) { … … 1162 1164 * @since 2.3.0 1163 1165 * 1164 * @param int|WP_Post $post _idPost ID or object.1166 * @param int|WP_Post $post Post ID or object. 1165 1167 * @return WP_Term[]|false|WP_Error Array of WP_Term objects on success, false if there are no terms 1166 1168 * or the post does not exist, WP_Error on failure. 1167 1169 */ 1168 function get_the_tags( $post _id= 0 ) {1169 $terms = get_the_terms( $post _id, 'post_tag' );1170 function get_the_tags( $post = 0 ) { 1171 $terms = get_the_terms( $post, 'post_tag' ); 1170 1172 1171 1173 /** … … 1279 1281 function get_the_terms( $post, $taxonomy ) { 1280 1282 $post = get_post( $post ); 1283 1281 1284 if ( ! $post ) { 1282 1285 return false; … … 1284 1287 1285 1288 $terms = get_object_term_cache( $post->ID, $taxonomy ); 1289 1286 1290 if ( false === $terms ) { 1287 1291 $terms = wp_get_object_terms( $post->ID, $taxonomy ); … … 1477 1481 * @param string|int|array $category Optional. The category name/term_id/slug, 1478 1482 * or an array of them to check for. Default empty. 1479 * @param int| object $post Optional. Post to check instead ofthe current post.1483 * @param int|WP_Post $post Optional. Post to check. Defaults to the current post. 1480 1484 * @return bool True if the current post has any of the given categories 1481 1485 * (or any category, if no category specified). False otherwise. … … 1504 1508 * @param string|int|array $tag Optional. The tag name/term_id/slug, 1505 1509 * or an array of them to check for. Default empty. 1506 * @param int| object $post Optional. Post to check instead ofthe current post.1510 * @param int|WP_Post $post Optional. Post to check. Defaults to the current post. 1507 1511 * @return bool True if the current post has any of the given tags 1508 1512 * (or any tag, if no tag specified). False otherwise. … … 1525 1529 * or an array of them to check for. Default empty. 1526 1530 * @param string $taxonomy Optional. Taxonomy name. Default empty. 1527 * @param int|WP_Post $post Optional. Post to check instead ofthe current post.1531 * @param int|WP_Post $post Optional. Post to check. Defaults to the current post. 1528 1532 * @return bool True if the current post has any of the given terms 1529 1533 * (or any term, if no term specified). False otherwise. -
trunk/src/wp-includes/comment-template.php
r53576 r53715 427 427 * Default empty. 428 428 * @param int|WP_Comment $comment Comment ID or WP_Comment object. Default current comment. 429 * @param int|WP_Post $post _idPost ID or WP_Post object. Default current post.429 * @param int|WP_Post $post Post ID or WP_Post object. Default current post. 430 430 * @param bool $display Optional. Whether to print or return the output. 431 431 * Default true. 432 432 * @return void|string Void if `$display` argument is true, comment classes if `$display` is false. 433 433 */ 434 function comment_class( $css_class = '', $comment = null, $post _id= null, $display = true ) {434 function comment_class( $css_class = '', $comment = null, $post = null, $display = true ) { 435 435 // Separates classes with a single space, collates classes for comment DIV. 436 $css_class = 'class="' . implode( ' ', get_comment_class( $css_class, $comment, $post _id) ) . '"';436 $css_class = 'class="' . implode( ' ', get_comment_class( $css_class, $comment, $post ) ) . '"'; 437 437 438 438 if ( $display ) { … … 455 455 * @param string|string[] $css_class Optional. One or more classes to add to the class list. Default empty. 456 456 * @param int|WP_Comment $comment_id Comment ID or WP_Comment object. Default current comment. 457 * @param int|WP_Post $post _idPost ID or WP_Post object. Default current post.457 * @param int|WP_Post $post Post ID or WP_Post object. Default current post. 458 458 * @return string[] An array of classes. 459 459 */ 460 function get_comment_class( $css_class = '', $comment_id = null, $post _id= null ) {460 function get_comment_class( $css_class = '', $comment_id = null, $post = null ) { 461 461 global $comment_alt, $comment_depth, $comment_thread_alt; 462 462 … … 477 477 $classes[] = 'comment-author-' . sanitize_html_class( $user->user_nicename, $comment->user_id ); 478 478 // For comment authors who are the author of the post. 479 $ post = get_post( $post_id);480 if ( $ post ) {481 if ( $comment->user_id === $ post->post_author ) {479 $_post = get_post( $post ); 480 if ( $_post ) { 481 if ( $comment->user_id === $_post->post_author ) { 482 482 $classes[] = 'bypostauthor'; 483 483 } … … 535 535 * @param string $comment_id The comment ID as a numeric string. 536 536 * @param WP_Comment $comment The comment object. 537 * @param int|WP_Post $post _idThe post ID or WP_Post object.538 */ 539 return apply_filters( 'comment_class', $classes, $css_class, $comment->comment_ID, $comment, $post _id);537 * @param int|WP_Post $post The post ID or WP_Post object. 538 */ 539 return apply_filters( 'comment_class', $classes, $css_class, $comment->comment_ID, $comment, $post ); 540 540 } 541 541 … … 809 809 * @since 1.5.0 810 810 * 811 * @param int|WP_Post $post _idOptional. Post ID or WP_Post object. Default is global $post.811 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. 812 812 * @return string The link to the comments. 813 813 */ 814 function get_comments_link( $post _id= 0 ) {815 $hash = get_comments_number( $post _id) ? '#comments' : '#respond';816 $comments_link = get_permalink( $post _id) . $hash;814 function get_comments_link( $post = 0 ) { 815 $hash = get_comments_number( $post ) ? '#comments' : '#respond'; 816 $comments_link = get_permalink( $post ) . $hash; 817 817 818 818 /** … … 822 822 * 823 823 * @param string $comments_link Post comments permalink with '#comments' appended. 824 * @param int|WP_Post $post _idPost ID or WP_Post object.825 */ 826 return apply_filters( 'get_comments_link', $comments_link, $post _id);824 * @param int|WP_Post $post Post ID or WP_Post object. 825 */ 826 return apply_filters( 'get_comments_link', $comments_link, $post ); 827 827 } 828 828 … … 850 850 * @since 1.5.0 851 851 * 852 * @param int|WP_Post $post _idOptional. Post ID or WP_Post object. Default is the global `$post`.852 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is the global `$post`. 853 853 * @return string|int If the post exists, a numeric string representing the number of comments 854 854 * the post has, otherwise 0. 855 855 */ 856 function get_comments_number( $post_id = 0 ) { 857 $post = get_post( $post_id ); 858 859 if ( ! $post ) { 860 $count = 0; 861 } else { 862 $count = $post->comment_count; 863 $post_id = $post->ID; 864 } 856 function get_comments_number( $post = 0 ) { 857 $post = get_post( $post ); 858 859 $count = $post ? $post->comment_count : 0; 860 $post_id = $post ? $post->ID : 0; 865 861 866 862 /** … … 879 875 * 880 876 * @since 0.71 881 * @since 5.4.0 The `$deprecated` parameter was changed to `$post _id`.882 * 883 * @param string|false $zero 884 * @param string|false $one 885 * @param string|false $more 886 * @param int|WP_Post $post _idOptional. Post ID or WP_Post object. Default is the global `$post`.887 */ 888 function comments_number( $zero = false, $one = false, $more = false, $post _id= 0 ) {889 echo get_comments_number_text( $zero, $one, $more, $post _id);877 * @since 5.4.0 The `$deprecated` parameter was changed to `$post`. 878 * 879 * @param string|false $zero Optional. Text for no comments. Default false. 880 * @param string|false $one Optional. Text for one comment. Default false. 881 * @param string|false $more Optional. Text for more than one comment. Default false. 882 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is the global `$post`. 883 */ 884 function comments_number( $zero = false, $one = false, $more = false, $post = 0 ) { 885 echo get_comments_number_text( $zero, $one, $more, $post ); 890 886 } 891 887 … … 894 890 * 895 891 * @since 4.0.0 896 * @since 5.4.0 Added the `$post _id` parameter to allow using the function outside of the loop.897 * 898 * @param string $zero 899 * @param string $one 900 * @param string $more 901 * @param int|WP_Post $post _idOptional. Post ID or WP_Post object. Default is the global `$post`.892 * @since 5.4.0 Added the `$post` parameter to allow using the function outside of the loop. 893 * 894 * @param string $zero Optional. Text for no comments. Default false. 895 * @param string $one Optional. Text for one comment. Default false. 896 * @param string $more Optional. Text for more than one comment. Default false. 897 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is the global `$post`. 902 898 * @return string Language string for the number of comments a post has. 903 899 */ 904 function get_comments_number_text( $zero = false, $one = false, $more = false, $post _id= 0 ) {905 $number = get_comments_number( $post _id);900 function get_comments_number_text( $zero = false, $one = false, $more = false, $post = 0 ) { 901 $number = get_comments_number( $post ); 906 902 907 903 if ( $number > 1 ) { … … 1236 1232 * @since 1.5.0 1237 1233 * 1238 * @param int|WP_Post $post _idPost ID or WP_Post object. Default current post.1234 * @param int|WP_Post $post Post ID or WP_Post object. Default current post. 1239 1235 * @return bool True if the comments are open. 1240 1236 */ 1241 function comments_open( $post_id = null ) { 1242 1243 $_post = get_post( $post_id ); 1237 function comments_open( $post = null ) { 1238 $_post = get_post( $post ); 1244 1239 1245 1240 $post_id = $_post ? $_post->ID : 0; … … 1266 1261 * @since 1.5.0 1267 1262 * 1268 * @param int|WP_Post $post _idPost ID or WP_Post object. Default current post.1263 * @param int|WP_Post $post Post ID or WP_Post object. Default current post. 1269 1264 * @return bool True if pings are accepted 1270 1265 */ 1271 function pings_open( $post_id = null ) { 1272 1273 $_post = get_post( $post_id ); 1266 function pings_open( $post = null ) { 1267 $_post = get_post( $post ); 1274 1268 1275 1269 $post_id = $_post ? $_post->ID : 0; … … 1516 1510 * 1517 1511 * @param array $comments Array of comments supplied to the comments template. 1518 * @param int $post_ IDPost ID.1512 * @param int $post_id Post ID. 1519 1513 */ 1520 1514 $wp_query->comments = apply_filters( 'comments_array', $comments_flat, $post->ID ); … … 2325 2319 * @type string $format The comment form format. Default 'xhtml'. Accepts 'xhtml', 'html5'. 2326 2320 * } 2327 * @param int|WP_Post $post _idPost ID or WP_Post object to generate the form for. Default current post.2328 */ 2329 function comment_form( $args = array(), $post _id= null ) {2330 if ( null === $post_id ) {2331 $post_id = get_the_ID(); 2332 }2321 * @param int|WP_Post $post Post ID or WP_Post object to generate the form for. Default current post. 2322 */ 2323 function comment_form( $args = array(), $post = null ) { 2324 $post = get_post( $post ); 2325 2326 $post_id = $post ? $post->ID : get_the_ID(); 2333 2327 2334 2328 // Exit the function when comments for the post are closed. -
trunk/src/wp-includes/comment.php
r53458 r53715 150 150 151 151 /** 152 * Retrieves the approved comments for post $post_id.152 * Retrieves the approved comments for a post. 153 153 * 154 154 * @since 2.0.0 … … 860 860 */ 861 861 function wp_check_comment_flood( $is_flood, $ip, $email, $date, $avoid_die = false ) { 862 863 862 global $wpdb; 864 863 … … 1448 1447 function wp_delete_comment( $comment_id, $force_delete = false ) { 1449 1448 global $wpdb; 1449 1450 1450 $comment = get_comment( $comment_id ); 1451 1451 if ( ! $comment ) { … … 1992 1992 function wp_insert_comment( $commentdata ) { 1993 1993 global $wpdb; 1994 1994 1995 $data = wp_unslash( $commentdata ); 1995 1996 … … 2652 2653 function wp_update_comment_count_now( $post_id ) { 2653 2654 global $wpdb; 2655 2654 2656 $post_id = (int) $post_id; 2657 2655 2658 if ( ! $post_id ) { 2656 2659 return false; … … 2661 2664 2662 2665 $post = get_post( $post_id ); 2666 2663 2667 if ( ! $post ) { 2664 2668 return false; … … 2887 2891 * 2888 2892 * @since 1.5.0 2889 * @since 4.7.0 `$post _id` can be a WP_Post object.2893 * @since 4.7.0 `$post` can be a WP_Post object. 2890 2894 * 2891 2895 * @global wpdb $wpdb WordPress database abstraction object. 2892 2896 * 2893 * @param int|WP_Post $post _id Post object or IDto do trackbacks on.2894 */ 2895 function do_trackbacks( $post _id) {2897 * @param int|WP_Post $post Post ID or object to do trackbacks on. 2898 */ 2899 function do_trackbacks( $post ) { 2896 2900 global $wpdb; 2897 $post = get_post( $post_id ); 2901 2902 $post = get_post( $post ); 2903 2898 2904 if ( ! $post ) { 2899 2905 return false; … … 2902 2908 $to_ping = get_to_ping( $post ); 2903 2909 $pinged = get_pung( $post ); 2910 2904 2911 if ( empty( $to_ping ) ) { 2905 2912 $wpdb->update( $wpdb->posts, array( 'to_ping' => '' ), array( 'ID' => $post->ID ) ); … … 2948 2955 * 2949 2956 * @param int $post_id Post ID. 2950 * @return int Same as Post ID from parameter2957 * @return int Same post ID as provided. 2951 2958 */ 2952 2959 function generic_ping( $post_id = 0 ) { … … 2968 2975 * 2969 2976 * @since 0.71 2970 * @since 4.7.0 `$post _id` can be a WP_Post object.2977 * @since 4.7.0 `$post` can be a WP_Post object. 2971 2978 * 2972 2979 * @param string $content Post content to check for links. If empty will retrieve from post. 2973 * @param int|WP_Post $post _id Post Object or ID.2974 */ 2975 function pingback( $content, $post _id) {2980 * @param int|WP_Post $post Post ID or object. 2981 */ 2982 function pingback( $content, $post ) { 2976 2983 include_once ABSPATH . WPINC . '/class-IXR.php'; 2977 2984 include_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php'; … … 2980 2987 $post_links = array(); 2981 2988 2982 $post = get_post( $post_id ); 2989 $post = get_post( $post ); 2990 2983 2991 if ( ! $post ) { 2984 2992 return; … … 3033 3041 * @param string[] $post_links Array of link URLs to be checked (passed by reference). 3034 3042 * @param string[] $pung Array of link URLs already pinged (passed by reference). 3035 * @param int $post_ IDThe post ID.3043 * @param int $post_id The post ID. 3036 3044 */ 3037 3045 do_action_ref_array( 'pre_ping', array( &$post_links, &$pung, $post->ID ) ); -
trunk/src/wp-includes/deprecated.php
r53685 r53715 3632 3632 * @see get_permalink() 3633 3633 * 3634 * @param int|WP_Post $post _idOptional. Post ID or WP_Post object. Default is global $post.3634 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. 3635 3635 * @return string|false 3636 3636 */ 3637 function post_permalink( $post _id= 0 ) {3637 function post_permalink( $post = 0 ) { 3638 3638 _deprecated_function( __FUNCTION__, '4.4.0', 'get_permalink()' ); 3639 3639 3640 return get_permalink( $post _id);3640 return get_permalink( $post ); 3641 3641 } 3642 3642 -
trunk/src/wp-includes/embed.php
r53455 r53715 538 538 * @since 4.4.0 539 539 * 540 * @param WP_Post|int $post Post object or ID.540 * @param WP_Post|int $post Post ID or post object. 541 541 * @param int $width The requested width. 542 542 * @return array|false Response data on success, false if post doesn't exist -
trunk/src/wp-includes/general-template.php
r53703 r53715 2681 2681 * was written. Accepts 'G', 'U', or PHP date format. 2682 2682 * Defaults to the 'time_format' option. 2683 * @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object.2683 * @param int|WP_Post $post Post ID or post object. Default is global `$post` object. 2684 2684 * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. 2685 2685 * False on failure. … … 2717 2717 * was written. Accepts 'G', 'U', or PHP date format. Default 'U'. 2718 2718 * @param bool $gmt Optional. Whether to retrieve the GMT time. Default false. 2719 * @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object.2719 * @param int|WP_Post $post Post ID or post object. Default is global `$post` object. 2720 2720 * @param bool $translate Whether to translate the time string. Default false. 2721 2721 * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. … … 2778 2778 * @since 5.3.0 2779 2779 * 2780 * @param int|WP_Post $post Optional. WP_Post object or ID. Default is global `$post` object.2780 * @param int|WP_Post $post Optional. Post ID or post object. Default is global `$post` object. 2781 2781 * @param string $field Optional. Published or modified time to use from database. Accepts 'date' or 'modified'. 2782 2782 * Default 'date'. … … 2823 2823 * @since 5.3.0 2824 2824 * 2825 * @param int|WP_Post $post Optional. WP_Post object or ID. Default is global `$post` object.2825 * @param int|WP_Post $post Optional. Post ID or post object. Default is global `$post` object. 2826 2826 * @param string $field Optional. Published or modified time to use from database. Accepts 'date' or 'modified'. 2827 2827 * Default 'date'. … … 2906 2906 * was modified. Accepts 'G', 'U', or PHP date format. Default 'U'. 2907 2907 * @param bool $gmt Optional. Whether to retrieve the GMT time. Default false. 2908 * @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object.2908 * @param int|WP_Post $post Post ID or post object. Default is global `$post` object. 2909 2909 * @param bool $translate Whether to translate the time string. Default false. 2910 2910 * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. -
trunk/src/wp-includes/link-template.php
r53520 r53715 312 312 * @global WP_Rewrite $wp_rewrite WordPress rewrite component. 313 313 * 314 * @param int|WP_Post $ idOptional. Post ID or post object. Default is the global `$post`.314 * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. 315 315 * @param bool $leavename Optional. Whether to keep post name. Default false. 316 316 * @param bool $sample Optional. Is it a sample permalink. Default false. 317 317 * @return string|WP_Error The post permalink. 318 318 */ 319 function get_post_permalink( $ id= 0, $leavename = false, $sample = false ) {319 function get_post_permalink( $post = 0, $leavename = false, $sample = false ) { 320 320 global $wp_rewrite; 321 321 322 $post = get_post( $ id);322 $post = get_post( $post ); 323 323 324 324 if ( is_wp_error( $post ) ) { … … 1299 1299 1300 1300 $post_type_obj = get_post_type_object( $post_type ); 1301 1301 1302 if ( ! $post_type_obj ) { 1302 1303 return false; … … 1403 1404 function get_preview_post_link( $post = null, $query_args = array(), $preview_link = '' ) { 1404 1405 $post = get_post( $post ); 1406 1405 1407 if ( ! $post ) { 1406 1408 return; … … 1437 1439 * @since 2.3.0 1438 1440 * 1439 * @param int|WP_Post $ idOptional. Post ID or post object. Default is the global `$post`.1441 * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. 1440 1442 * @param string $context Optional. How to output the '&' character. Default '&'. 1441 1443 * @return string|null The edit post link for the given post. Null if the post type does not exist 1442 1444 * or does not allow an editing UI. 1443 1445 */ 1444 function get_edit_post_link( $id = 0, $context = 'display' ) { 1445 $post = get_post( $id ); 1446 function get_edit_post_link( $post = 0, $context = 'display' ) { 1447 $post = get_post( $post ); 1448 1446 1449 if ( ! $post ) { 1447 1450 return; … … 1457 1460 1458 1461 $post_type_object = get_post_type_object( $post->post_type ); 1462 1459 1463 if ( ! $post_type_object ) { 1460 1464 return; … … 1493 1497 * @param string $before Optional. Display before edit link. Default empty. 1494 1498 * @param string $after Optional. Display after edit link. Default empty. 1495 * @param int|WP_Post $ idOptional. Post ID or post object. Default is the global `$post`.1499 * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. 1496 1500 * @param string $class Optional. Add custom class to link. Default 'post-edit-link'. 1497 1501 */ 1498 function edit_post_link( $text = null, $before = '', $after = '', $id = 0, $class = 'post-edit-link' ) { 1499 $post = get_post( $id ); 1502 function edit_post_link( $text = null, $before = '', $after = '', $post = 0, $class = 'post-edit-link' ) { 1503 $post = get_post( $post ); 1504 1500 1505 if ( ! $post ) { 1501 1506 return; … … 1503 1508 1504 1509 $url = get_edit_post_link( $post->ID ); 1510 1505 1511 if ( ! $url ) { 1506 1512 return; … … 1532 1538 * @since 2.9.0 1533 1539 * 1534 * @param int|WP_Post $ idOptional. Post ID or post object. Default is the global `$post`.1540 * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. 1535 1541 * @param string $deprecated Not used. 1536 1542 * @param bool $force_delete Optional. Whether to bypass Trash and force deletion. Default false. 1537 1543 * @return string|void The delete post link URL for the given post. 1538 1544 */ 1539 function get_delete_post_link( $ id= 0, $deprecated = '', $force_delete = false ) {1545 function get_delete_post_link( $post = 0, $deprecated = '', $force_delete = false ) { 1540 1546 if ( ! empty( $deprecated ) ) { 1541 1547 _deprecated_argument( __FUNCTION__, '3.0.0' ); 1542 1548 } 1543 1549 1544 $post = get_post( $id ); 1550 $post = get_post( $post ); 1551 1545 1552 if ( ! $post ) { 1546 1553 return; … … 1548 1555 1549 1556 $post_type_object = get_post_type_object( $post->post_type ); 1557 1550 1558 if ( ! $post_type_object ) { 1551 1559 return; … … 1789 1797 1790 1798 $post = get_post(); 1799 1791 1800 if ( ! $post || ! taxonomy_exists( $taxonomy ) ) { 1792 1801 return null; … … 2133 2142 function get_boundary_post( $in_same_term = false, $excluded_terms = '', $start = true, $taxonomy = 'category' ) { 2134 2143 $post = get_post(); 2144 2135 2145 if ( ! $post || ! is_single() || is_attachment() || ! taxonomy_exists( $taxonomy ) ) { 2136 2146 return null; -
trunk/src/wp-includes/media.php
r53685 r53715 4300 4300 * Arguments for enqueuing media scripts. 4301 4301 * 4302 * @type int|WP_Post $post A post object or ID.4302 * @type int|WP_Post $post Post ID or post object. 4303 4303 * } 4304 4304 */ -
trunk/src/wp-includes/post-template.php
r53656 r53715 118 118 $post = get_post( $post ); 119 119 120 $ title = isset( $post->post_title ) ? $post->post_title : '';121 $ id = isset( $post->ID ) ? $post->ID : 0;120 $post_title = isset( $post->post_title ) ? $post->post_title : ''; 121 $post_id = isset( $post->ID ) ? $post->ID : 0; 122 122 123 123 if ( ! is_admin() ) { … … 139 139 */ 140 140 $protected_title_format = apply_filters( 'protected_title_format', $prepend, $post ); 141 $title = sprintf( $protected_title_format, $title ); 141 142 $post_title = sprintf( $protected_title_format, $post_title ); 142 143 } elseif ( isset( $post->post_status ) && 'private' === $post->post_status ) { 143 144 … … 157 158 */ 158 159 $private_title_format = apply_filters( 'private_title_format', $prepend, $post ); 159 $title = sprintf( $private_title_format, $title ); 160 161 $post_title = sprintf( $private_title_format, $post_title ); 160 162 } 161 163 } … … 166 168 * @since 0.71 167 169 * 168 * @param string $ title The post title.169 * @param int $ id The post ID.170 * @param string $post_title The post title. 171 * @param int $post_id The post ID. 170 172 */ 171 return apply_filters( 'the_title', $ title, $id );173 return apply_filters( 'the_title', $post_title, $post_id ); 172 174 } 173 175 … … 188 190 $post = get_post( $post ); 189 191 190 $ guid = isset( $post->guid ) ? get_the_guid( $post ) : '';191 $ id = isset( $post->ID ) ? $post->ID : 0;192 $post_guid = isset( $post->guid ) ? get_the_guid( $post ) : ''; 193 $post_id = isset( $post->ID ) ? $post->ID : 0; 192 194 193 195 /** … … 198 200 * @see get_the_guid() 199 201 * 200 * @param string $ guid Escaped Global Unique Identifier (guid) of the post.201 * @param int $ id The post ID.202 * @param string $post_guid Escaped Global Unique Identifier (guid) of the post. 203 * @param int $post_id The post ID. 202 204 */ 203 echo apply_filters( 'the_guid', $ guid, $id );205 echo apply_filters( 'the_guid', $post_guid, $post_id ); 204 206 } 205 207 … … 219 221 $post = get_post( $post ); 220 222 221 $ guid = isset( $post->guid ) ? $post->guid : '';222 $ id = isset( $post->ID ) ? $post->ID : 0;223 $post_guid = isset( $post->guid ) ? $post->guid : ''; 224 $post_id = isset( $post->ID ) ? $post->ID : 0; 223 225 224 226 /** … … 227 229 * @since 1.5.0 228 230 * 229 * @param string $ guid Global Unique Identifier (guid) of the post.230 * @param int $ id The post ID.231 * @param string $post_guid Global Unique Identifier (guid) of the post. 232 * @param int $post_id The post ID. 231 233 */ 232 return apply_filters( 'get_the_guid', $ guid, $id );234 return apply_filters( 'get_the_guid', $post_guid, $post_id ); 233 235 } 234 236 … … 452 454 * @since 2.7.0 453 455 * 454 * @param string|string[] $class 455 * @param int|WP_Post $post _idOptional. Post ID or post object. Defaults to the global `$post`.456 */ 457 function post_class( $class = '', $post _id= null ) {456 * @param string|string[] $class One or more classes to add to the class list. 457 * @param int|WP_Post $post Optional. Post ID or post object. Defaults to the global `$post`. 458 */ 459 function post_class( $class = '', $post = null ) { 458 460 // Separates classes with a single space, collates classes for post DIV. 459 echo 'class="' . esc_attr( implode( ' ', get_post_class( $class, $post _id) ) ) . '"';461 echo 'class="' . esc_attr( implode( ' ', get_post_class( $class, $post ) ) ) . '"'; 460 462 } 461 463 … … 477 479 * @since 4.2.0 Custom taxonomy class names were added. 478 480 * 479 * @param string|string[] $class 480 * @param int|WP_Post $post _idOptional. Post ID or post object.481 * @param string|string[] $class Space-separated string or array of class names to add to the class list. 482 * @param int|WP_Post $post Optional. Post ID or post object. 481 483 * @return string[] Array of class names. 482 484 */ 483 function get_post_class( $class = '', $post _id= null ) {484 $post = get_post( $post _id);485 function get_post_class( $class = '', $post = null ) { 486 $post = get_post( $post ); 485 487 486 488 $classes = array(); … … 1581 1583 * @since 2.0.0 1582 1584 * 1583 * @param int|WP_Post $ idOptional. Post ID or post object.1584 * @param bool $fullsize 1585 * @param bool $deprecated 1586 * @param bool $permalink 1587 */ 1588 function the_attachment_link( $ id= 0, $fullsize = false, $deprecated = false, $permalink = false ) {1585 * @param int|WP_Post $post Optional. Post ID or post object. 1586 * @param bool $fullsize Optional. Whether to use full size. Default false. 1587 * @param bool $deprecated Deprecated. Not used. 1588 * @param bool $permalink Optional. Whether to include permalink. Default false. 1589 */ 1590 function the_attachment_link( $post = 0, $fullsize = false, $deprecated = false, $permalink = false ) { 1589 1591 if ( ! empty( $deprecated ) ) { 1590 1592 _deprecated_argument( __FUNCTION__, '2.5.0' ); … … 1592 1594 1593 1595 if ( $fullsize ) { 1594 echo wp_get_attachment_link( $ id, 'full', $permalink );1596 echo wp_get_attachment_link( $post, 'full', $permalink ); 1595 1597 } else { 1596 echo wp_get_attachment_link( $ id, 'thumbnail', $permalink );1598 echo wp_get_attachment_link( $post, 'thumbnail', $permalink ); 1597 1599 } 1598 1600 } … … 1602 1604 * 1603 1605 * @since 2.5.0 1604 * @since 4.4.0 The `$ id` parameter can now accept either a post ID or `WP_Post` object.1605 * 1606 * @param int|WP_Post $ idOptional. Post ID or post object.1606 * @since 4.4.0 The `$post` parameter can now accept either a post ID or `WP_Post` object. 1607 * 1608 * @param int|WP_Post $post Optional. Post ID or post object. 1607 1609 * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array 1608 1610 * of width and height values in pixels (in that order). Default 'thumbnail'. … … 1614 1616 * @return string HTML content. 1615 1617 */ 1616 function wp_get_attachment_link( $ id= 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) {1617 $_post = get_post( $ id);1618 function wp_get_attachment_link( $post = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) { 1619 $_post = get_post( $post ); 1618 1620 1619 1621 if ( empty( $_post ) || ( 'attachment' !== $_post->post_type ) || ! wp_get_attachment_url( $_post->ID ) ) { … … 1642 1644 $link_text = esc_html( pathinfo( get_attached_file( $_post->ID ), PATHINFO_FILENAME ) ); 1643 1645 } 1646 1647 $link_html = "<a href='" . esc_url( $url ) . "'>$link_text</a>"; 1648 1644 1649 /** 1645 1650 * Filters a retrieved attachment page link. … … 1649 1654 * 1650 1655 * @param string $link_html The page link HTML output. 1651 * @param int|WP_Post $ idPost ID or object. Can be 0 for the current global post.1656 * @param int|WP_Post $post Post ID or object. Can be 0 for the current global post. 1652 1657 * @param string|int[] $size Requested image size. Can be any registered image size name, or 1653 1658 * an array of width and height values in pixels (in that order). … … 1657 1662 * @param array|string $attr Array or string of attributes. 1658 1663 */ 1659 return apply_filters( 'wp_get_attachment_link', "<a href='" . esc_url( $url ) . "'>$link_text</a>", $id, $size, $permalink, $icon, $text, $attr );1664 return apply_filters( 'wp_get_attachment_link', $link_html, $post, $size, $permalink, $icon, $text, $attr ); 1660 1665 } 1661 1666 … … 1826 1831 function wp_post_revision_title( $revision, $link = true ) { 1827 1832 $revision = get_post( $revision ); 1833 1828 1834 if ( ! $revision ) { 1829 1835 return $revision; … … 1867 1873 function wp_post_revision_title_expanded( $revision, $link = true ) { 1868 1874 $revision = get_post( $revision ); 1875 1869 1876 if ( ! $revision ) { 1870 1877 return $revision; … … 1928 1935 * @since 2.6.0 1929 1936 * 1930 * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post. 1931 * @param string $type 'all' (default), 'revision' or 'autosave' 1932 */ 1933 function wp_list_post_revisions( $post_id = 0, $type = 'all' ) { 1934 $post = get_post( $post_id ); 1937 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. 1938 * @param string $type 'all' (default), 'revision' or 'autosave' 1939 */ 1940 function wp_list_post_revisions( $post = 0, $type = 'all' ) { 1941 $post = get_post( $post ); 1942 1935 1943 if ( ! $post ) { 1936 1944 return; … … 1944 1952 1945 1953 $revisions = wp_get_post_revisions( $post->ID ); 1954 1946 1955 if ( ! $revisions ) { 1947 1956 return; -
trunk/src/wp-includes/post.php
r53685 r53715 1145 1145 // Get parent status prior to trashing. 1146 1146 $post_status = get_post_meta( $post->post_parent, '_wp_trash_meta_status', true ); 1147 1147 1148 if ( ! $post_status ) { 1148 1149 // Assume publish as above. … … 2244 2245 if ( is_scalar( $post_type ) ) { 2245 2246 $post_type = get_post_type_object( $post_type ); 2247 2246 2248 if ( ! $post_type ) { 2247 2249 return false; … … 2287 2289 if ( is_scalar( $post_status ) ) { 2288 2290 $post_status = get_post_status_object( $post_status ); 2291 2289 2292 if ( ! $post_status ) { 2290 2293 return false; … … 2580 2583 function get_post_custom( $post_id = 0 ) { 2581 2584 $post_id = absint( $post_id ); 2585 2582 2586 if ( ! $post_id ) { 2583 2587 $post_id = get_the_ID(); … … 4190 4194 */ 4191 4195 $post_date = wp_resolve_post_date( $postarr['post_date'], $postarr['post_date_gmt'] ); 4196 4192 4197 if ( ! $post_date ) { 4193 4198 if ( $wp_error ) { … … 4863 4868 * @since 2.5.0 4864 4869 * 4865 * @param int|WP_Post $post _idPost ID or post object.4866 */ 4867 function check_and_publish_future_post( $post _id) {4868 $post = get_post( $post _id);4870 * @param int|WP_Post $post Post ID or post object. 4871 */ 4872 function check_and_publish_future_post( $post ) { 4873 $post = get_post( $post ); 4869 4874 4870 4875 if ( ! $post ) { … … 4880 4885 // Uh oh, someone jumped the gun! 4881 4886 if ( $time > time() ) { 4882 wp_clear_scheduled_hook( 'publish_future_post', array( $post _id) ); // Clear anything else in the system.4883 wp_schedule_single_event( $time, 'publish_future_post', array( $post _id) );4887 wp_clear_scheduled_hook( 'publish_future_post', array( $post->ID ) ); // Clear anything else in the system. 4888 wp_schedule_single_event( $time, 'publish_future_post', array( $post->ID ) ); 4884 4889 return; 4885 4890 } 4886 4891 4887 4892 // wp_publish_post() returns no meaningful value. 4888 wp_publish_post( $post _id);4893 wp_publish_post( $post->ID ); 4889 4894 } 4890 4895 … … 5376 5381 function wp_after_insert_post( $post, $update, $post_before ) { 5377 5382 $post = get_post( $post ); 5383 5378 5384 if ( ! $post ) { 5379 5385 return; … … 5404 5410 * 5405 5411 * @since 1.5.0 5406 * @since 4.7.0 `$post _id` can be a WP_Post object.5412 * @since 4.7.0 `$post` can be a WP_Post object. 5407 5413 * @since 4.7.0 `$uri` can be an array of URIs. 5408 5414 * 5409 5415 * @global wpdb $wpdb WordPress database abstraction object. 5410 5416 * 5411 * @param int|WP_Post $post _id Post object or ID.5412 * @param string|array $uri 5417 * @param int|WP_Post $post Post ID or post object. 5418 * @param string|array $uri Ping URI or array of URIs. 5413 5419 * @return int|false How many rows were updated. 5414 5420 */ 5415 function add_ping( $post _id, $uri ) {5421 function add_ping( $post, $uri ) { 5416 5422 global $wpdb; 5417 5423 5418 $post = get_post( $post _id);5424 $post = get_post( $post ); 5419 5425 5420 5426 if ( ! $post ) { … … 5487 5493 * @since 1.5.0 5488 5494 * 5489 * @since 4.7.0 `$post _id` can be a WP_Post object.5490 * 5491 * @param int|WP_Post $post _idPost ID or object.5495 * @since 4.7.0 `$post` can be a WP_Post object. 5496 * 5497 * @param int|WP_Post $post Post ID or object. 5492 5498 * @return string[]|false Array of URLs already pinged for the given post, false if the post is not found. 5493 5499 */ 5494 function get_pung( $post _id) {5495 $post = get_post( $post _id);5500 function get_pung( $post ) { 5501 $post = get_post( $post ); 5496 5502 5497 5503 if ( ! $post ) { … … 5516 5522 * 5517 5523 * @since 1.5.0 5518 * @since 4.7.0 `$post _id` can be a WP_Post object.5519 * 5520 * @param int|WP_Post $post _id Post Object or ID5524 * @since 4.7.0 `$post` can be a WP_Post object. 5525 * 5526 * @param int|WP_Post $post Post ID or post object. 5521 5527 * @return string[]|false List of URLs yet to ping. 5522 5528 */ 5523 function get_to_ping( $post _id) {5524 $post = get_post( $post _id);5529 function get_to_ping( $post ) { 5530 $post = get_post( $post ); 5525 5531 5526 5532 if ( ! $post ) { … … 7079 7085 foreach ( $post_types as $post_type ) { 7080 7086 $post_type_obj = get_post_type_object( $post_type ); 7087 7081 7088 if ( ! $post_type_obj ) { 7082 7089 continue; … … 7093 7100 */ 7094 7101 $cap = apply_filters_deprecated( 'pub_priv_sql_capability', array( '' ), '3.2.0' ); 7102 7095 7103 if ( ! $cap ) { 7096 7104 $cap = current_user_can( $post_type_obj->cap->read_private_posts ); … … 7099 7107 // Only need to check the cap if $public_only is false. 7100 7108 $post_status_sql = "post_status = 'publish'"; 7109 7101 7110 if ( false === $public_only ) { 7102 7111 if ( $cap ) { … … 7640 7649 function wp_get_post_parent_id( $post = null ) { 7641 7650 $post = get_post( $post ); 7651 7642 7652 if ( ! $post || is_wp_error( $post ) ) { 7643 7653 return false; 7644 7654 } 7655 7645 7656 return (int) $post->post_parent; 7646 7657 } -
trunk/src/wp-includes/revision.php
r53300 r53715 113 113 114 114 $post = get_post( $post_id ); 115 115 116 if ( ! $post ) { 116 117 return; … … 276 277 function wp_is_post_revision( $post ) { 277 278 $post = wp_get_post_revision( $post ); 279 278 280 if ( ! $post ) { 279 281 return false; … … 293 295 function wp_is_post_autosave( $post ) { 294 296 $post = wp_get_post_revision( $post ); 297 295 298 if ( ! $post ) { 296 299 return false; … … 356 359 * @since 2.6.0 357 360 * 358 * @param int|WP_Post $post The post ID orobject.361 * @param int|WP_Post $post Post ID or post object. 359 362 * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which 360 363 * correspond to a WP_Post object, an associative array, or a numeric array, … … 365 368 function wp_get_post_revision( &$post, $output = OBJECT, $filter = 'raw' ) { 366 369 $revision = get_post( $post, OBJECT, $filter ); 370 367 371 if ( ! $revision ) { 368 372 return $revision; 369 373 } 374 370 375 if ( 'revision' !== $revision->post_type ) { 371 376 return null; … … 392 397 * @since 2.6.0 393 398 * 394 * @param int|WP_Post $revision _idRevision ID or revision object.395 * @param array $fields 399 * @param int|WP_Post $revision Revision ID or revision object. 400 * @param array $fields Optional. What fields to restore from. Defaults to all. 396 401 * @return int|false|null Null if error, false if no fields to restore, (int) post ID if success. 397 402 */ 398 function wp_restore_post_revision( $revision_id, $fields = null ) { 399 $revision = wp_get_post_revision( $revision_id, ARRAY_A ); 403 function wp_restore_post_revision( $revision, $fields = null ) { 404 $revision = wp_get_post_revision( $revision, ARRAY_A ); 405 400 406 if ( ! $revision ) { 401 407 return $revision; … … 420 426 421 427 $post_id = wp_update_post( $update ); 428 422 429 if ( ! $post_id || is_wp_error( $post_id ) ) { 423 430 return $post_id; … … 447 454 * @since 2.6.0 448 455 * 449 * @param int|WP_Post $revision _idRevision ID or revision object.456 * @param int|WP_Post $revision Revision ID or revision object. 450 457 * @return WP_Post|false|null Null or false if error, deleted post object if success. 451 458 */ 452 function wp_delete_post_revision( $revision_id ) { 453 $revision = wp_get_post_revision( $revision_id ); 459 function wp_delete_post_revision( $revision ) { 460 $revision = wp_get_post_revision( $revision ); 461 454 462 if ( ! $revision ) { 455 463 return $revision; … … 457 465 458 466 $delete = wp_delete_post( $revision->ID ); 467 459 468 if ( $delete ) { 460 469 /** … … 479 488 * @see get_children() 480 489 * 481 * @param int|WP_Post $post _idOptional. Post ID or WP_Post object. Default is global `$post`.482 * @param array|null $args 490 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. 491 * @param array|null $args Optional. Arguments for retrieving post revisions. Default null. 483 492 * @return array An array of revisions, or an empty array if none. 484 493 */ 485 function wp_get_post_revisions( $post_id = 0, $args = null ) { 486 $post = get_post( $post_id ); 494 function wp_get_post_revisions( $post = 0, $args = null ) { 495 $post = get_post( $post ); 496 487 497 if ( ! $post || empty( $post->ID ) ) { 488 498 return array(); … … 510 520 511 521 $revisions = get_children( $args ); 522 512 523 if ( ! $revisions ) { 513 524 return array(); … … 522 533 * @since 5.9.0 523 534 * 524 * @param int|WP_Post $post _idOptional. Post ID or WP_Post object. Default is global `$post`.535 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. 525 536 * @return null|string The URL for editing revisions on the given post, otherwise null. 526 537 */ 527 function wp_get_post_revisions_url( $post _id= 0 ) {528 $post = get_post( $post _id);538 function wp_get_post_revisions_url( $post = 0 ) { 539 $post = get_post( $post ); 529 540 530 541 if ( ! $post instanceof WP_Post ) { … … 685 696 function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) { 686 697 $post = get_post(); 698 687 699 if ( ! $post ) { 688 700 return $terms; … … 720 732 function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) { 721 733 $post = get_post(); 734 722 735 if ( ! $post ) { 723 736 return $value; … … 735 748 736 749 $thumbnail_id = (int) $_REQUEST['_thumbnail_id']; 750 737 751 if ( $thumbnail_id <= 0 ) { 738 752 return ''; … … 784 798 $now = time(); 785 799 $result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, 'no') /* LOCK */", $lock, $now ) ); 800 786 801 if ( ! $result ) { 787 802 // If we couldn't get a lock, see how old the previous lock is. 788 803 $locked = get_option( $lock ); 804 789 805 if ( ! $locked ) { 790 806 // Can't write to the lock, and can't read the lock.
Note: See TracChangeset
for help on using the changeset viewer.