Make WordPress Core


Ignore:
Timestamp:
09/20/2022 04:29:11 AM (21 months ago)
Author:
peterwilsoncc
Message:

Posts, Post types: Prevent get_sample_permalink() modifying the post object.

get_sample_permalink() (ab)uses the $post->filter property to indicate a sample permalink is being generated for the post. This change ensures the property is restored to its original value.

Props herregroen, hellofromTonya, peterwilsoncc, Rahmohn, costdev.
Fixes #54736.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/post.php

    r54122 r54244  
    14001400    $original_date   = $post->post_date;
    14011401    $original_name   = $post->post_name;
     1402    $original_filter = $post->filter;
    14021403
    14031404    // Hack: get_permalink() would return plain permalink for drafts, so we will fake that our post is published.
     
    14441445    $post->post_date   = $original_date;
    14451446    $post->post_name   = $original_name;
    1446     unset( $post->filter );
     1447    $post->filter      = $original_filter;
    14471448
    14481449    /**
Note: See TracChangeset for help on using the changeset viewer.