Best way to programatically add “rel” attributes to page and post images
image_send_to_editor function insert_img_rel_attrib( $html, $id, $caption, $title, $align, $url, $size, $alt ) { /* Run your magic on the image $html to insert rel attrib */ return $html; } add_filter( ‘image_send_to_editor’, ‘insert_img_rel_attrib’ );