• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Remove media links from WP post media | Is SQL the best way?

kingding

Member
Aug 17, 2019
75
37
18
In my wordpress posts, some images are clickable and some are not. When they are clicked, they open a new page. I do not want any clicking & url behaviour.

I could go through every single post in the backend, click every image, and disable each media link... but that would take years! My best thought is to do an SQL query to remove any instance of <a></a> from divs with the wp-block-image class.

Essentially...
- IF "<a href="https://wordpress: ... " exists after "<figure class="wp-block-image">", then delete "<a ... >"
- IF "</a>" exists after "<img src="https: //wordpress- ... >", then delete "</a>"

Unless of course you have a better idea than SQL? 🤔
 

Attachments

use plugin Hide My WP

Thanks, but that doesn't seem relevant. Maybe there's a feature in there that can do this, but it's a whole security plugin which is overkill. I need a permanent solution that will actually alter the wp_post 👍
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock