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. Built from https://develop.svn.wordpress.org/trunk@54244 git-svn-id: http://core.svn.wordpress.org/trunk@53803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ee24b9b733
commit
e241ac664a
|
@ -1399,6 +1399,7 @@ function get_sample_permalink( $post, $title = null, $name = null ) {
|
|||
$original_status = $post->post_status;
|
||||
$original_date = $post->post_date;
|
||||
$original_name = $post->post_name;
|
||||
$original_filter = $post->filter;
|
||||
|
||||
// Hack: get_permalink() would return plain permalink for drafts, so we will fake that our post is published.
|
||||
if ( in_array( $post->post_status, array( 'draft', 'pending', 'future' ), true ) ) {
|
||||
|
@ -1443,7 +1444,7 @@ function get_sample_permalink( $post, $title = null, $name = null ) {
|
|||
$post->post_status = $original_status;
|
||||
$post->post_date = $original_date;
|
||||
$post->post_name = $original_name;
|
||||
unset( $post->filter );
|
||||
$post->filter = $original_filter;
|
||||
|
||||
/**
|
||||
* Filters the sample permalink.
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.1-alpha-54243';
|
||||
$wp_version = '6.1-alpha-54244';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue