SAFEER N
SAFEER N

Reputation: 1197

Wordpress the_content(); showing content and attachements

I am using wordpress 3.6 and advanced custom field plugin 4.2.1.

advanced custom field settings - https://dl.dropboxusercontent.com/u/15109395/q/acf-media.png

my post - https://dl.dropboxusercontent.com/u/15109395/q/page-content.png

my single page code

<section id="contentLeft" class="single">   
    <?php if ( have_posts() ) { the_post(); the_content(); }?>
</section>

Result - https://dl.dropboxusercontent.com/u/15109395/q/page-front.png

but , i don't want that attachment image on content area. my local installation have no problem. not showing attachments. but my live website showing attachment uploaded to that post. how can i solve this issue? please help me. Thanks.

Upvotes: 0

Views: 2230

Answers (2)

SAFEER N
SAFEER N

Reputation: 1197

My problem solved with this solution. Thanks. http://wordpress.org/support/topic/thumbnails-magically-appearing-on-all-pages

Upvotes: 1

Jothi Kannan
Jothi Kannan

Reputation: 3358

if you want remove images from all posts and pages, simple copy the following code into your theme functions.php

<?php
function remove_images( $content ) {
   $postOutput = preg_replace('/<img[^>]+./','', $content);
   return $postOutput;
}
add_filter( 'the_content', 'remove_images', 100 );
?>

it will remove the images wherever the_content() have images

else you need to include this function in specific page , put the following code

<?php remove_filter( 'the_content', 'remove_images' ); ?>

Upvotes: 0

Related Questions