src/lib/Post.php
/**
     * @param string $context Hierarchical or not.
     */
@param string $context Hierarchical or not.
@param string $context Hierarchical or not .
public function taxonomies(string $context = ''): array
    {
        $tax = [];
        if (!($objects = \get_object_taxonomies(
            $this->get()->post_type,
            'objects'
        ))) {
            return $tax;
        }
        foreach ($objects as $slug => $object) {
            if ('hierarchical' === $context
                && !\is_taxonomy_hierarchical($slug)
            ) {
                continue;
            }
            if ('non_hierarchical' === $context
                && \is_taxonomy_hierarchical($slug)
            ) {
                continue;
            }
            $terms = \get_the_terms($this->get(), $slug);
            if (!$terms || \is_wp_error($terms)) {
                continue;
            }
            foreach ($terms as $term) {
                $tax[$slug][(int)$term->term_id] = $term;
            }
        }
        return $tax;
    }
public function taxonomies ( string $ context = '' ) : array { $ tax = [ ] ; if ( ! ( $ objects = \ get_object_taxonomies ( $ this -> get ( ) -> post_type , 'objects' ) ) ) { return $ tax ; } foreach ( $ objects as $ slug => $ object ) { if ( 'hierarchical' === $ context && ! \ is_taxonomy_hierarchical ( $ slug ) ) { continue ; } if ( 'non_hierarchical' === $ context && \ is_taxonomy_hierarchical ( $ slug ) ) { continue ; } $ terms = \ get_the_terms ( $ this -> get ( ) , $ slug ) ; if ( ! $ terms || \ is_wp_error ( $ terms ) ) { continue ; } foreach ( $ terms as $ term ) { $ tax [ $ slug ] [ ( int ) $ term -> term_id ] = $ term ; } } return $ tax ; }
@param string $context Hierarchical or not.
@param string $context Hierarchical or not .