[wp-trac] [WordPress Trac] #53025: Change to get_permalink in 5.7 breaks existing code

WordPress Trac noreply at wordpress.org
Tue Apr 13 03:02:47 UTC 2021

#53025: Change to get_permalink in 5.7 breaks existing code
 Reporter:  turbodb       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Security      |     Version:  5.7
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:

Comment (by turbodb):

 I've played around with this some more, and I believe the bug was actually
 on my side, but didn't manifest until 5.7.

 Specifically, the line of code:

 $my_post->post_status = 'published';

 is incorrect. The status there should be 'publish' rather than the past

 In pre-5.7 incarnations of get_permalink(), the function may have checked
 for status <> 'draft' or that contained 'publish' and as such, my code
 worked. However, with the new more stringent checks, my code no longer
 passed the check for a pretty permalink.

 I've updated my code, and verified that even with the fix for #5272,
 everything works as expected.

 This ticket can be closed.

Ticket URL: <https://core.trac.wordpress.org/ticket/53025#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list