カスタムフィールドを扱うプラグインを幾つか試してみました。
Types が気に入りました
■ Advanced Custom Fields プラグイン
- Custom Fieldsを作るのは簡単
- Custom Fieldsの値を表示させるのはコードを手書き編集する必要あり
■ カスタムフィールドテンプレート プラグイン
- Custom Fieldsを作るのは簡単。
- Custom Fieldsの値を表示させるのも、[cft format=0]などを投稿に書くだけで簡単
でも、[cft format=0]は手打ち - インストールしただけで、Temper Level、Favorite Fruits、Miles WalkedなどのCustom Fieldを作っちゃうのが嫌。後で消すのが面倒
■ Types プラグイン
- TypesはCustom Fieldsの作成も表示もコードを編集せずに可能
- 投稿にCustom Fieldsの値を貼るためのGUIもあり、手打ちしなくて良い。
- 「Custom Fields Control」メニューもあり、作ったCustom Fieldはキチンと消せる
カスタムフィールドの削除
いろいろ試したあとは、カスタムの削除です
Delete Custom Fields プラグイン
- Custom Fields の値は消してくれるプラグイン
- Custom Fields 名はDBに残ったまま。
手作業で削除
DB 内のテーブル wp_postmetaのフィールド meta_keyがCustom Fieldsと一致するレコードを検索して削除する
webminを使って削除することも可能
コンソール使ってコマンドラインで削除
mysql -u root -D データベース名 -p
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6164
Server version: 5.5.40 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql>delete * from wp_postmeta where meta_key = ‘Custom Field名’;
で削除する