set_custom_fields example

// Empty value deletes, non-empty value adds/updates.             if ( ! $post_data['post_thumbnail'] ) {
                delete_post_thumbnail( $post_id );
            } elseif ( ! get_post( absint( $post_data['post_thumbnail'] ) ) ) {
                return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
            }
            set_post_thumbnail( $post_id$post_data['post_thumbnail'] );
            unset( $content_struct['post_thumbnail'] );
        }

        if ( isset( $post_data['custom_fields'] ) ) {
            $this->set_custom_fields( $post_id$post_data['custom_fields'] );
        }

        if ( isset( $post_data['terms'] ) || isset( $post_data['terms_names'] ) ) {
            $post_type_taxonomies = get_object_taxonomies( $post_data['post_type'], 'objects' );

            // Accumulate term IDs from terms and terms_names.             $terms = array();

            // First validate the terms specified by ID.             if ( isset( $post_data['terms'] ) && is_array( $post_data['terms'] ) ) {
                $taxonomies = array_keys( $post_data['terms'] );

                
Home | Imprint | This part of the site doesn't use cookies.