[wp-trac] [WordPress Trac] #61068: Wrong processing post_status for custom post_status
WordPress Trac
noreply at wordpress.org
Wed Apr 24 12:51:27 UTC 2024
#61068: Wrong processing post_status for custom post_status
-------------------------------+-----------------------------
Reporter: uNknownMark | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 6.5
Severity: normal | Keywords:
Focuses: |
-------------------------------+-----------------------------
I have added a custom post status with the register_post_status function
with such args.
{{{#!php
<?php
$args = array(
'label' => _x( 'Processing', 'Status
General Name', 'text_domain' ),
'public' => true,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'exclude_from_search' => false,
'_builtin' => false,
'internal' => false,
'protected' => false,
'private' => false,
'publicly_queryable' => true,
);
register_post_status( 'cm_processing', $args );
$args = array(
'label' => _x( 'Completed', 'Status
General Name', 'text_domain' ),
'public' => true,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'exclude_from_search' => false,
'_builtin' => false,
'internal' => false,
'protected' => false,
'private' => false,
'publicly_queryable' => true,
);
register_post_status( 'cm_completed', $args );
}}}
But when I created a new post and set the status "processing" it saved as
a draft. Same story if I edit already existing posts.
As far as I see main problem with post status processing happened in
function
{{{
_wp_translate_postdata
}}}
in the file
{{{
wp-admin/includes/post.php
}}}
Looks like resetting custom post status happened in this piece of code
{{{#!php
<?php
// What to do based on which button they pressed.
if ( isset( $post_data['saveasdraft'] ) && '' !==
$post_data['saveasdraft'] ) {
$post_data['post_status'] = 'draft';
}
if ( isset( $post_data['saveasprivate'] ) && '' !==
$post_data['saveasprivate'] ) {
$post_data['post_status'] = 'private';
}
if ( isset( $post_data['publish'] ) && ( '' !==
$post_data['publish'] )
&& ( ! isset( $post_data['post_status'] ) || 'private' !==
$post_data['post_status'] )
) {
$post_data['post_status'] = 'publish';
}
if ( isset( $post_data['advanced'] ) && '' !==
$post_data['advanced'] ) {
$post_data['post_status'] = 'draft';
}
if ( isset( $post_data['pending'] ) && '' !==
$post_data['pending'] ) {
$post_data['post_status'] = 'pending';
}
}}}
P.S. Any working workaround while waiting to fix it?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61068>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list