'name', 'order' => 'ASC', 'hide_empty' => false, 'hierarchical' => true, 'exclude' => array( 1 ), ) ); $post_categories = wp_get_post_categories( $post_id ); if ( ! is_array( $post_categories ) ) { $post_categories = array(); } $post_categories = array_flip( $post_categories ); $hierarchical_categories = array(); /** @var WP_Term $category */ foreach ( $categories as $category ) { if ( 0 === $category->parent ) { if ( ! isset( $hierarchical_categories[ $category->term_id ] ) ) { $hierarchical_categories[ $category->term_id ] = array( 'category' => $category, 'children' => array(), ); } else { $hierarchical_categories[ $category->term_id ]['category'] = $category; } } else { if ( ! isset( $hierarchical_categories[ $category->parent ] ) ) { $hierarchical_categories[ $category->parent ] = array( 'category' => null, 'children' => array(), ); } $hierarchical_categories[ $category->parent ]['children'][] = $category; } if ( isset( $post_categories[ $category->term_id ] ) ) { $post_categories[ $category->term_id ] = $category->name; } } $currently_featured_video = get_option( 'videopress_hq_featured_video' ); ?>