Ticket #40780: 40780.patch
| File 40780.patch, 4.8 KB (added by , 9 years ago) |
|---|
-
src/wp-includes/link-template.php
247 247 * 248 248 * @global WP_Rewrite $wp_rewrite 249 249 * 250 * @param int $id Optional. Post ID. Default uses the global `$post`.251 * @param bool $leavename Optional, defaults to false. Whether to keep post name. Default false.252 * @param bool $sample Optional, defaults to false. Is it a sample permalink. Default false.250 * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. 251 * @param bool $leavename Optional, defaults to false. Whether to keep post name. Default false. 252 * @param bool $sample Optional, defaults to false. Is it a sample permalink. Default false. 253 253 * @return string|WP_Error The post permalink. 254 254 */ 255 function get_post_permalink( $ id= 0, $leavename = false, $sample = false ) {255 function get_post_permalink( $post = 0, $leavename = false, $sample = false ) { 256 256 global $wp_rewrite; 257 257 258 $post = get_post( $id);258 $post = get_post( $post ); 259 259 260 260 if ( is_wp_error( $post ) ) 261 261 return $post; … … 264 264 265 265 $slug = $post->post_name; 266 266 267 $draft_or_pending = get_post_status( $ id ) && in_array( get_post_status( $id), array( 'draft', 'pending', 'auto-draft', 'future' ) );267 $draft_or_pending = get_post_status( $post ) && in_array( get_post_status( $post ), array( 'draft', 'pending', 'auto-draft', 'future' ) ); 268 268 269 269 $post_type = get_post_type_object($post->post_type); 270 270 271 271 if ( $post_type->hierarchical ) { 272 $slug = get_page_uri( $ id);272 $slug = get_page_uri( $post ); 273 273 } 274 274 275 275 if ( !empty($post_link) && ( !$draft_or_pending || $sample ) ) { … … 1262 1262 * 1263 1263 * @since 2.3.0 1264 1264 * 1265 * @param int $id Optional. Post ID. Default is the ID ofthe global `$post`.1266 * @param string $context Optional. How to output the '&' character. Default '&'.1265 * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. 1266 * @param string $context Optional. How to output the '&' character. Default '&'. 1267 1267 * @return string|null The edit post link for the given post. null if the post type is invalid or does 1268 1268 * not allow an editing UI. 1269 1269 */ 1270 function get_edit_post_link( $ id= 0, $context = 'display' ) {1271 if ( ! $post = get_post( $ id) )1270 function get_edit_post_link( $post = 0, $context = 'display' ) { 1271 if ( ! $post = get_post( $post ) ) 1272 1272 return; 1273 1273 1274 1274 if ( 'revision' === $post->post_type ) … … 1310 1310 * @since 1.0.0 1311 1311 * @since 4.4.0 The `$class` argument was added. 1312 1312 * 1313 * @param string $text Optional. Anchor text. If null, default is 'Edit This'. Default null.1314 * @param string $before Optional. Display before edit link. Default empty.1315 * @param string $after Optional. Display after edit link. Default empty.1316 * @param int $id Optional. Post ID. Default is the ID ofthe global `$post`.1317 * @param string $class Optional. Add custom class to link. Default 'post-edit-link'.1313 * @param string $text Optional. Anchor text. If null, default is 'Edit This'. Default null. 1314 * @param string $before Optional. Display before edit link. Default empty. 1315 * @param string $after Optional. Display after edit link. Default empty. 1316 * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. 1317 * @param string $class Optional. Add custom class to link. Default 'post-edit-link'. 1318 1318 */ 1319 function edit_post_link( $text = null, $before = '', $after = '', $ id= 0, $class = 'post-edit-link' ) {1320 if ( ! $post = get_post( $ id) ) {1319 function edit_post_link( $text = null, $before = '', $after = '', $post = 0, $class = 'post-edit-link' ) { 1320 if ( ! $post = get_post( $post ) ) { 1321 1321 return; 1322 1322 } 1323 1323 … … 1350 1350 * 1351 1351 * @since 2.9.0 1352 1352 * 1353 * @param int $id Optional. Post ID. Default is the ID ofthe global `$post`.1354 * @param string $deprecated Not used.1355 * @param bool $force_delete Optional. Whether to bypass trash and force deletion. Default false.1353 * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. 1354 * @param string $deprecated Not used. 1355 * @param bool $force_delete Optional. Whether to bypass trash and force deletion. Default false. 1356 1356 * @return string|void The delete post link URL for the given post. 1357 1357 */ 1358 function get_delete_post_link( $ id= 0, $deprecated = '', $force_delete = false ) {1358 function get_delete_post_link( $post = 0, $deprecated = '', $force_delete = false ) { 1359 1359 if ( ! empty( $deprecated ) ) 1360 1360 _deprecated_argument( __FUNCTION__, '3.0.0' ); 1361 1361 1362 if ( !$post = get_post( $ id) )1362 if ( !$post = get_post( $post ) ) 1363 1363 return; 1364 1364 1365 1365 $post_type_object = get_post_type_object( $post->post_type );