*/ public function reference_hints(): array { return array( '_thumbnail_id' => 'attachment', ); } /** * Counts for the module card. * * @return array */ public function counts(): array { $counts = array(); foreach ( $this->post_types() as $post_type ) { $per_status = wp_count_posts( $post_type ); // Attachments are never 'publish' — they inherit their parent's status. $status = 'attachment' === $post_type ? 'inherit' : 'publish'; $counts[ $post_type ] = isset( $per_status->$status ) ? (int) $per_status->$status : 0; } foreach ( $this->taxonomies() as $taxonomy ) { $total = wp_count_terms( array( 'taxonomy' => $taxonomy, 'hide_empty' => false, ) ); $counts[ $taxonomy ] = is_wp_error( $total ) ? 0 : (int) $total; } return $counts; } }