最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - Remove and strip html tag values

programmeradmin5浏览0评论

I have imported some blog posts from an external site and there were unnecessary html tags and values I wanted to get rid of like the sizes and srcset including their values for all blog posts. It goes something like this:

<img src="/wp-content/uploads/2024/12/AHG-guitar-blond-girl-Pixabay-1024x683.jpg" sizes="(max-width: 1024px) 100vw, 1024px" srcset="/wp-content/uploads/2024/12/AHG-guitar-blond-girl-Pixabay-1024x683.jpg 1024w, /wp-content/uploads/2024/12/AHG-guitar-blond-girl-Pixabay-300x200.jpg 300w, /wp-content/uploads/2024/12/AHG-guitar-blond-girl-Pixabay-768x512.jpg 768w, /wp-content/uploads/2024/12/AHG-guitar-blond-girl-Pixabay-1536x1025.jpg 1536w, /wp-content/uploads/2024/12/AHG-guitar-blond-girl-Pixabay.jpg 1919w" alt="" width="1024" height="683" />

I'm using WP Migrate DB Pro Find and Replace feature and have tried regex combinations below but nothing seems to work.

<img[^>]+srcset="([^">]+)" and <img[^>]+sizes="([^">]+)"

Appreciate any help. Thanks

发布评论

评论列表(0)

  1. 暂无评论