Navigation überspringen

[Gelöst] Custom status in post form

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:

The issue here is that the user's custom post status created with PHP isn't showing up in the Forms status option.

Solution:

In this user's case they didn't add the following lines to their function

'show_in_admin_all_list'    => true,
      'show_in_admin_status_list' => true,

These lines are required for the custom status to show up as an option in our Forms plugin.

This support ticket is created vor 3 Jahren, 5 Monaten. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Dieses Thema enthält 2 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von jesusM-6 vor 3 Jahren, 5 Monaten.

Assistiert von: Shane.

Author
Artikel
#2115241
soporte toolset 01.jpg

I have registered 2 new status in wordpress with the following code:

if ( ! function_exists('creado_status') ) {
// Register Custom Status
function creado_status() {
$args = array(
'label' => _x( 'creado', 'Status General Name', 'text_domain' ),
'label_count' => _n_noop( 'creado (%s)', 'creados (%s)', 'text_domain' ),
);
register_post_status( 'creado', $args );
}
add_action( 'init', 'creado_status', 0 );
}

if ( ! function_exists('aceptado_status') ) {
// Register Custom Status
function aceptado_status() {
$args = array(
'label' => _x( 'aceptado', 'Status General Name', 'text_domain' ),
'label_count' => _n_noop( 'aceptado (%s)', 'aceptados (%s)', 'text_domain' ),
);
register_post_status( 'aceptado', $args );
}
add_action( 'init', 'aceptado_status', 0 );
}

But I can't see them in the list

#2115579

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hello,

I tried to register a custom post status with the code below and it work fine.


function wpdocs_custom_post_status(){
    register_post_status( 'unread', array(
        'label'                     => _x( 'Unread', 'post' ),
        'public'                    => true,
        'exclude_from_search'       => false,
        'show_in_admin_all_list'    => true,
        'show_in_admin_status_list' => true,
        'label_count'               => _n_noop( 'Unread <span class="count">(%s)</span>', 'Unread <span class="count">(%s)</span>' ),
    ) );
}
add_action( 'init', 'wpdocs_custom_post_status' );

Checking on your code it would appear that you are missing these 2 lines

  'show_in_admin_all_list'    => true,
        'show_in_admin_status_list' => true,

These lines are what make the custom status appear in the list.

Thanks,
Shane

#2116359

My issue is resolved now. Thank you!