I’am having a problem with making the image a background of my div

add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 );
add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 );
function remove_width_attribute( $html ) {
   $html = preg_replace( '/(width|height)="d*"s/', "", $html );
   return $html;
$args = array( 'numberposts' => '1' );
$recent_posts = wp_get_recent_posts( $args ); 
foreach( $recent_posts as $recent ){
    echo '<div style="background-image: url('.'" title="Look '. '" >'.get_the_post_thumbnail( $recent["ID"], 'full' . ' col-lg-6' ) . '';}

which comes out as

<div style="background-image: url("
<img="" src="http://localhost/~blabla/wordpress/wp-content/uploads/2014/07/kp_2012_10_korteshoot-86.jpg" 
class="attachment-full col-lg-6 wp-post-image" 

The problem is really that i’am getting the img scr and not the url..
how do i get rid of


Read more here: Removing the <img="" src= from wordpress thumbnail


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: