get_post_types()accetta una matrice di argomenti per abbinare i campi di un oggetto di tipo post . Quindi, potresti fare qualcosa del genere (non testato):
$post_types = get_post_types(array(
'public' => true,
'supports' => array( 'editor', 'title', 'thumbnail' )
), 'objects');
Sfortunatamente, non puoi impostare qualcosa come "escludi" in questa funzione e ottieni solo tipi di post che supportano esattamente 'editor', 'title', 'thumbnail' , né più né meno.
Oppure potresti usare get_post_types_by_support()(solo per WP 4.5 e versioni successive. Inoltre, tieni presente che non puoi escludere specifici tipi di post con questa funzione, ma per il caso specifico di supporto per editor, title, thumbnail, il tipo di post allegato sarà escluso nella maggior parte dei casi).
$post_types = get_post_types_by_support( array( 'editor', 'title', 'thumbnail' ) );
Se vuoi qualcosa che funzioni in ogni caso, proverei a ottenere tipi di post basati su criteri più ampi, quindi costruisci il tuo array, qualcosa del genere:
$_post_types = get_post_types_by_support( array( 'editor', 'title', 'thumbnail' ) );
$post_types = [];
foreach($_post_types as $post_type) {
// In most cases, attachment post type won't be here, but it can be
if( $post_type->name !== 'attachment' ) {
$post_types[] = $post_type;
}
}