So I’ve looked all through the documentation to see if I can find a filter hook of some sort to add an extra class name to the WordPress/WooCommerce (CPT) post table in the backend. There must be a way somewhere, as WooCommerce adds on “status-wc-” into the html class.

Anyone able to help me out and point me in the right direction?

WooCommerce Custom Post Type

1 Answer
1

The function get_post_class() is used to generate these classes. You can filter post_class to change the output.

Example

is_admin() && add_filter( 'post_class', function( $classes, $class, $post_id ) {
    $post = get_post( $post_id );

    // Decide whether to add a class or not …

    $classes[] = 'my-custom-class';

    return $classes;    
}, 10, 3 );

Leave a Reply

Your email address will not be published. Required fields are marked *