get_post_meta_by_id example

foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) {
            if ( isset( $post_data[ 'id3_' . $key ] ) ) {
                $id3data[ $key ] = sanitize_text_field( wp_unslash( $post_data[ 'id3_' . $key ] ) );
            }
        }
        wp_update_attachment_metadata( $post_id$id3data );
    }

    // Meta stuff.     if ( isset( $post_data['meta'] ) && $post_data['meta'] ) {
        foreach ( $post_data['meta'] as $key => $value ) {
            $meta = get_post_meta_by_id( $key );
            if ( ! $meta ) {
                continue;
            }

            if ( $meta->post_id != $post_id ) {
                continue;
            }

            if ( is_protected_meta( $meta->meta_key, 'post' )
                || ! current_user_can( 'edit_post_meta', $post_id$meta->meta_key )
            ) {
                
Home | Imprint | This part of the site doesn't use cookies.