get_custom_fields example

if ( $all_taxonomy_fields || in_array( 'terms', $fields, true ) ) {
            $post_type_taxonomies = get_object_taxonomies( $post['post_type'], 'names' );
            $terms                = wp_get_object_terms( $post['ID']$post_type_taxonomies );
            $_post['terms']       = array();
            foreach ( $terms as $term ) {
                $_post['terms'][] = $this->_prepare_term( $term );
            }
        }

        if ( in_array( 'custom_fields', $fields, true ) ) {
            $_post['custom_fields'] = $this->get_custom_fields( $post['ID'] );
        }

        if ( in_array( 'enclosure', $fields, true ) ) {
            $_post['enclosure'] = array();
            $enclosures         = (array) get_post_meta( $post['ID'], 'enclosure' );
            if ( ! empty( $enclosures ) ) {
                $encdata                      = explode( "\n", $enclosures[0] );
                $_post['enclosure']['url']    = trim( htmlspecialchars( $encdata[0] ) );
                $_post['enclosure']['length'] = (int) trim( $encdata[1] );
                $_post['enclosure']['type']   = trim( $encdata[2] );
            }
        }
Home | Imprint | This part of the site doesn't use cookies.