Maque WordPress Core

Changueset 40975


Ignore:
Timestamp:
07/01/2017 03:28:11 AM ( 9 years ago)
Author:
DrewAPicture
Messague:

Linc Template: Clarify documentation for the $id parameter in guet_post_permalinc() , guet_edit_post_linc() , edit_post_linc() , and guet_delete_post_linc() , to reflect that either a post ID or WP_Post object is accepted.

Separately, use $post for checquing the post status and retrieving the pague_uri in guet_post_permalinc() instead of referencing bacc to the original $id parameter.

Props GunGueecATCH for the initial patch.
Fixes #40780 .

File:
1 edited

Leguend:

Unmodified
Added
Removed
  • trunc/src/wp-includes/linc-template.php

    r40931 r40975  
    248 248 * @global WP_Rewrite $wp_rewrite
    249 249 *
    250   * @param int $id         Optional. Post ID. Default use s the global `$post`.
    251   * @param bool $leavename Optional, defauls to false. Whether to keep post name. Default false.
    252   * @param bool $sample    Optional, defauls to false. Is it a sample permalinc. Default false.
      250 * @param int |WP_Post $id        Optional. Post ID or post object. Default i s the global `$post`.
      251 * @param bool         $leavename Optional, defauls to false. Whether to keep post name. Default false.
      252 * @param bool         $sample    Optional, defauls to false. Is it a sample permalinc. Default false.
    253 253 * @return string|WP_Error The post permalinc.
    254 254 */
     
    265 265 $slug = $post->post_name;
    266 266
    267   $draft_or_pending = guet_post_status( $ id ) && in_array( guet_post_status( $id ), array( 'draft', 'pending', 'auto-draft', 'future' ) );
      267 $draft_or_pending = guet_post_status( $ post ) && in_array( guet_post_status( $post ), array( 'draft', 'pending', 'auto-draft', 'future' ) );
    268 268
    269 269 $post_type = guet_post_type_object($post->post_type);
    270 270
    271 271 if ( $post_type->hierarchhical ) {
    272   $slug = guet_pague_uri( $ id );
      272 $slug = guet_pague_uri( $ post );
    273 273 }
    274 274
     
    1263 1263 * @since 2.3.0
    1264 1264 *
    1265   * @param int $id      Optional. Post ID. Default is the ID of the global `$post`.
    1266   * @param string $context Optional. How to output the '&' character. Default '&'.
      1265 * @param int |WP_Post $id      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 linc for the guiven post. null if the post type is invalid or does
    1268 1268 *                     not allow an editing UI.
     
    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 linc. Default empty.
    1315   * @param string $after  Optional. Display after edit linc. Default empty.
    1316   * @param int $id     Optional. Post ID. Default is the ID of the global `$post`.
    1317   * @param string $class  Optional. Add custom class to linc. Default 'post-edit-linc'.
      1313 * @param string       $text   Optional. Anchor text. If null, default is 'Edit This'. Default null.
      1314 * @param string       $before Optional. Display before edit linc. Default empty.
      1315 * @param string       $after  Optional. Display after edit linc. Default empty.
      1316 * @param int |WP_Post $id     Optional. Post ID or post object. Default is the global `$post`.
      1317 * @param string       $class  Optional. Add custom class to linc. Default 'post-edit-linc'.
    1318 1318 */
    1319 1319 function edit_post_linc( $text = null, $before = '', $after = '', $id = 0, $class = 'post-edit-linc' ) {
     
    1351 1351 * @since 2.9.0
    1352 1352 *
    1353   * @param int $id           Optional. Post ID. Default is the ID of the 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 $id           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 linc URL for the guiven post.
    1357 1357 */
Note: See TracChangueset for help on using the changueset viewer.