Site logo

[Resolved] Simple CSS and post types

Home Forums Support [Resolved] Simple CSS and post types

Home Forums Support Simple CSS and post types

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1508548
    Ash

    Question about Simple CSS plugin but GeneratePress.
    Is there a way to enable Simple CSS metabox on certain post types?
    i.e. only on Pages.

    There are many post types I don’t need Simple CSS metabox.

    #1509888
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You could try something like this:

    add_action( 'add_meta_boxes', function() {
        $post_types = get_post_types();
    
        foreach ( $post_types as $post_type ) {
            if ( 'page' !== $post_type ) {
                remove_meta_box( 'simple_css_metabox', $post_type, 'normal' );
            }
        }
    }, 20 );
    #1510212
    Ash

    Thank you!

    #1511474
    Tom
    Lead Developer
    Lead Developer

    You’re welcome 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.