• How i may permanently remove first image from posts ?
    I know at least two ways to disable them, for example this one

    function remove_first_image ($content) {
    if (!is_page() && !is_feed() && !is_feed() && !is_home()) {
    $content = preg_replace("/<img[^>]+\>/i", "", $content, 1);
    } return $content;
    }
    add_filter('the_content', 'remove_first_image');

    and another one with css
    display:none

    But i want to permanently delete first images with Mysql query, because hiding images as described above continue braking website markup. If i manually delete image from post, then markup displayed normally.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Can you please elaborate it regarding the deletion? To delete the image permanently, you can go to the backend & open the corresponding posts & delete the image from the content.

    Thread Starter Cosmopull

    (@cosmopull)

    Actually i found why markup was broken it is because <!–more–> tag affects it not an image. Anyway it good to know how physically delete images. Seems this plugin good be handy – Search Regex

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove first image permanently’ is closed to new replies.