wordpress plugin - Remove original image after automatic creation of featured image -


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

add_action('publish_post', 'eliminaroriginal');

and then

function eliminaroriginal(){ //update 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 didn't have result. please me, don't know should do.

thank before hand!


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -