Saving a post, content filtering and user levels

I managed to figure it out myself (numbers of hours spent: way too high).

Initially I thought using the unfiltered_html capability for administrators would solve the issue. Even if it would (which it didn’t), it would be somewhat of a shotgun approach to a revolver issue.

Upon further searching, I learned that wordpress has a global list of allowed tags/attributes. Adding my attribute to the image tag solved it:

add_action( 'init', 'add_data_orientation_to_posttags' );
function add_data_orientation_to_posttags() {
    global $allowedposttags;

    $tags = array( 'img' );
    $new_attributes = array( 'data-orientation' => array() );

    foreach ( $tags as $tag ) {
        if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) )
            $allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes );
    }
}