Answer the question
In order to leave comments, you need to log in
How to remove rel links in WordPress?
Good afternoon! When adding images in the wordpress page editor marked as a link to an image, the attribute rel="attachment wp-att-$$$" is written in the link itself. Is it possible to somehow automatically remove this attribute from all links? And why does WordPress insert these attributes?) Thank you.
Answer the question
In order to leave comments, you need to log in
Something I don't see the automatic insertion of relation - screenshotuploader.com/s/1602fpe_c (WP v.4.3.3), there is a field in the editor, but for manual insertion. And so the relation is used for dynamic link management and this does not affect the front-end in any way. But if you really need it, then use a filter in the topic, for example, this one:
add_filter('image_send_to_editor', 'my_theme_remove_rel', 10, 2);
function my_theme_remove_rel($html, $id) {
if($id>0)
$html=str_replace('rel="attachment wp-att-'.$id.'"','',$html);
return $html;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question