Support » Plugin: Edit Flow » Different post status by post types

  • Hello,
    I have several different posts types (business page, coupon, purchases) that are edited by 3 different role users (admin, business_owner, client) depending on capabilities.

    So what if I have the next post types:

    • Business
    • pourchases
    • coupons

    Businnes pages, purchases and coupons are completely different… so I need different status by post type.

    Is there any way I can accomplish this ?
    Thanks
    Pepe

    https://wordpress.org/plugins/edit-flow/

Viewing 2 replies - 1 through 2 (of 2 total)
  • I managed it with this. Maybe there is better way but seems to work.

    function efx_limit_custom_statuses_by_type( $custom_statuses ) {
    
        $current_post_type = get_post_type();
        switch( $current_post_type == 'ticket' ) {
            // Only allow a contributor to access specific statuses from the dropdown
            case 'ticket':
                $permitted_statuses = array(
                        'pitch',
                        'draft',
                        'in-progress',
                    );
                // Remove the custom status if it's not whitelisted
                foreach( $custom_statuses as $key => $custom_status ) {
                    if ( !in_array( $custom_status->slug, $permitted_statuses ) )
                        unset( $custom_statuses[$key] );
                }
                break;
        }
        return $custom_statuses;
    }
    add_filter( 'ef_custom_status_list', 'efx_limit_custom_statuses_by_type' );

    Just noticed it doesnt recognize new post as part of this post type, unless you click something in post editing window (doesnt have to be “Publish” button) Dropdown is hidden with JS and CSS obviously, think so anyway.

    Will check it later, not so important now for me.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Different post status by post types’ is closed to new replies.