Changeset 53715 for trunk/src/wp-includes/link-template.php
- Timestamp:
- 07/18/2022 05:35:51 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/link-template.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)