Move attributes <img… in wordpress

In WordPress there are such variants of inserted pictures:

<img width=”***” height=”***” class=”alignleft” alt=”***” src=”http://***.png(or jpg)”>

or

<img class=”alignleft” src=”http://***.png(or jpg)” alt=”***” width=”***” height=”***”>

How to bring them to a single view:

<img src=”http://***.png(or jpg)” alt=”***” width=”***” height=”***” class=”alignleft” />

This is necessary for the AMP plug-in, namely “Featured Image from The Content
Show the first image of the content as Featured Image if there is no featured image”

Plugin defines the first image with this code

$output = preg_match_all(‘/<img.+src=[‘”]([^'”]+)[‘”].*.+width=[‘”]([^'”]+)[‘”].*.+height=[‘”]([^'”]+)[‘”].*>/i’, $post->post_content, $matches);

Sorry for My English

Read more here:: <a href=https://wordpress.stackexchange.com/questions/315513/move-attributes-img-in-wordpress target="_blank" title="Move attributes Move attributes <img… in wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *