プラグインhttp://wordpress.org/plugins/automatic-featured-image-posts/をインストールしましたが、特集画像を作成した後、プラグインが投稿コンテンツから元の画像を削除しないため、問題が発生しています。(したがって、注目の画像を追加しないと、投稿に2つの画像が表示されます)これをauto-featured-image.phpに追加してみました
add_action('publish_post', 'eliminaroriginal');
その後
function eliminaroriginal(){ //画像なしで投稿を更新 $post_parent_id = $post->post_parent === 0 ? $post->ID : $post->post_parent; $contenido = preg_replace("/[caption .+?[/caption]|\< [img][^>] [.]*>/i", "", $post->post_content, 1); $mipost = 配列(); $mipost['ID'] = $post_parent_id; $mipost['post_content'] = $contenido; wp_update_post( $mipost ); }
しかし結果が出ませんでした。どうすればいいのかわからないので、助けてください。
事前にありがとう!