Question

I installed the plugin http://wordpress.org/plugins/automatic-featured-image-posts/ but I am having a problemm, because the plugin doesn't remove the original image from the post content after creating the featured image. (and therefore when I don't add the featured image there appear 2 images on the post) I tried adding this to the auto-featured-image.php

add_action('publish_post', 'eliminaroriginal');

and then

function eliminaroriginal(){ //update the post without image $post_parent_id = $post->post_parent === 0 ? $post->ID : $post->post_parent; $contenido = preg_replace("/[caption .+?[/caption]|\< [img][^>][.]*>/i", "", $post->post_content, 1); $mipost = array(); $mipost['ID'] = $post_parent_id; $mipost['post_content'] = $contenido; wp_update_post( $mipost ); }

but it didn't have any result. Please help me, I don't know what should I do.

Thank you before hand!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top