サポート » プラグイン » advanced custom fields で作ったフィールドが設置できない

  • 解決済 tenten23

    (@tenten23)


    はじめまして
    Gatespaceさんの記事を参考にしてオリジナル権限のあるカスタムポストを設置しました。
    http://gatespace.jp/2012/05/24/custom-post-type-and-user-role-fix/

    $report_labels = array(
    		'name' => "レポート",
    		'singular_name' => "レポート",
    		'add_new' => "新規追加",
    		'add_new_item' => "新規レポート追加",
    		'edit_item' => "レポートを編集",
    		'new_item' => "新規レポート",
    		'view_item' => "表示",
    		'search_items' => "レポートを検索",
    		'not_found' => "見つかりません",
    		'not_found_in_trash' =>"ゴミ箱にはありません",
    		'parent_item_colon' => '親',
    		'menu_name' => 'レポート'
    	);
    	$report_args = array(
    		'labels' => $report_labels,
    		'public' => true,
    		'publicly_queryable' => true,
    		'show_ui' => true,
    		'show_in_menu' => true,
    		'query_var' => true,
    		'rewrite' => true,
    		'capability_type' => 'post_report', // 通常はpostだが任意のpost_reportにする
    		'has_archive' => true,
    		'hierarchical' => false,
    		'menu_position' => 5,
    		'map_meta_cap' => true,
    		'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),
    		'taxonomies' => array( 'reportcat' )
    	);
    	register_post_type( 'report', $report_args );
    }
    add_action( 'init', 'codex_custom_init', 0);

    こちらのカスタムポストにadvanced custom fieldsで作ったフィールドを設置したいのですが、ルールで投稿タイプ=>report、やユーザー(ログインしているユーザーも同様)=>オリジナル権限を設定しても、投稿画面には反映されませんでした。
    'capability_type' => 'post_report',

    'capability_type' => 'post',
    にするとカスタムフィールドは反映されましたが、当然カスタムポストだけでなく、通常の投稿にアクセスできてしまいます。このcapability_typeのままで、advanced custom fieldsを設置することはできないでしょうか?

1件の返信を表示中 - 1 - 1件目 (全1件中)
  • トピック投稿者 tenten23

    (@tenten23)

    自己解決できました。他のコードが邪魔していたようです

1件の返信を表示中 - 1 - 1件目 (全1件中)
  • トピック「advanced custom fields で作ったフィールドが設置できない」には新たに返信することはできません。