2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

「Custom Post Type UI」を使うとパーマリンク設定が期待通りにならない件

Posted at

やりたいこと

  • カスタム投稿にストアを登録
  • カスタムタクソノミーにエリアカテゴリーを登録
  • パーマリンクを https://domain/kanto/tokyo/1234 という構成にしたい

問題

カスタム投稿・タクソノミーの登録に「Custom Post Type UI」というプラグインを使うとカスタアム投稿ページが404ページになってしまった。

結論

カスタム投稿の登録はfunction.phpで行い解決。

詳細

カスタム投稿の登録には「Custom Post Type UI

パーマリンク設定には「Custom Post Type Permalinks

というプラグインを使いました。

以前全く同じ構成でパーマリンク設定を行なったことがあったので、できるということはわかっていました。

その時と違ったのがカスタム投稿の登録方法です。

 以前はカスタム投稿をfunction.phpで設定しており、今回は「Custom Post Type UI」プラグインを使用していました。

登録には様々オプションがありますが、全く同じ。

Custom Post Type UI」は登録する時のコードを出力してくれる機能があるので、コピーしてfunction.phpに貼り付け。プラグインを無効化して登録オプションが間違っているのかを検証したところ、404ページではなく投稿が正しく表示されました。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?