[wp-trac] [WordPress Trac] #32322: Custom permalink structure incorrect for Future posts
WordPress Trac
noreply at wordpress.org
Tue Apr 23 16:46:40 UTC 2019
#32322: Custom permalink structure incorrect for Future posts
-------------------------------------------------+-------------------------
Reporter: greencode | Owner: kdoole
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 5.3
Component: Permalinks | Version: 4.2
Severity: normal | Resolution:
Keywords: good-first-bug has-patch needs- | Focuses:
refresh |
-------------------------------------------------+-------------------------
Changes (by andraganescu):
* keywords: good-first-bug needs-unit-tests has-patch => good-first-bug
has-patch needs-refresh
* milestone: Awaiting Review => 5.3
Comment:
This patch still works and while it doesn't solve everything, as
@johnbillion noted four years ago, it does add a good filter instead of
the hardcoded statuses as they are now:
`if ( '' != $permalink && ! in_array( $post->post_status, array( 'draft',
'pending', 'auto-draft', 'future' ) ) ) {`
I wouldn't change anything else though, except run that array through a
filter twice. Wouldn't need to rename the `$draft_or_pending` var nor
change the conditional at line 159.
{{{
/**
* Filters the list of post statuses which should use shortlinks and avoid
fancy permalinks.
*
* @since 4.3.0
*
* @param array $statuses The list of statuses
*/
$auto_short_link_statuses = apply_filters( 'shortlink_post_statuses',
array(
'draft',
'pending',
'auto-draft',
'future'
) );
if ( '' != $permalink && ! in_array( $post->post_status,
$auto_short_link_statuses ) ) {
}}}
and later in the file just:
{{{
$auto_short_link_statuses = apply_filters( 'shortlink_post_statuses',
array(
'draft',
'pending',
'auto-draft',
'future'
) );
$draft_or_pending = get_post_status( $post ) && in_array( get_post_status(
$post ), $auto_short_link_statuses );
}}}
and that's that.
There still is the issue with the inconsistency of preview link but it is
a separate issue.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32322#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list