I can’t find the proper hook, but there is alternative solution: to add style="float:right"
to all images in content, which have class="alignright"
:
add_filter('the_content', 'my_add_image_float_right');
function my_add_image_float_right($content) {
$pattern = '@(<img.+)(alignright)(.*)(/>)@Ui';
$replacement="$1$2$3 style="float:right" />";
$content = preg_replace($pattern, $replacement, $content);
return $content;
}