前にスラッグに投稿の連番を入れてパーマリンクを自動で付けるように設定したけど、投稿の更新のときにも連番を取得しちゃってパーマリンクが変わってしまう問題が出た ちょっと調べて改善版ができたので記録 おさらい スラッグを使うとパーマリンクの%postname%を設定できる スラッグを使うには表示オプションからスラッグにチェックを入れる スラッグには初期値として<?php echo esc_attr( $post->post_name ); ?>が設定されている この初期値を公開前なら連番を取得、公開済みなら設定済みの値を取得するようにする そんなわけでコード <?php if(get_post_status() == 'publish'){ echo esc_attr( apply_filters('editable_slug', $post->post_name) ); } else { e