Remove images from the_content [duplicate]

Your function is not removing the p tags: they have not yet been added as get_the_content returns the unfiltered content. You can manually add the p tags using wpautop.

$unfiltered = preg_replace('/<img[^>]+\>/i', '',get_the_content());
$filtered = wpautop($unfiltered);

echo $filtered;

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)