Last active
August 16, 2017 06:21
-
-
Save tkc49/e1114c0e7203cb1a37bc to your computer and use it in GitHub Desktop.
タームをカスタマイズする際に必要なフック
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function plugins_loaded(){ | |
add_action ( 'edited_term',array($this,'save_extra_category_fileds')); // 編集画面の保存 | |
add_action ( 'created_term',array($this,'save_extra_category_fileds')); // 新規追加の保存 | |
} | |
public function init(){ | |
$args=array('public' => true,'_builtin' => false ); // builtin=false(WordPressが設定してるものは省く) | |
$output = 'names'; // or objects | |
$operator = 'and'; // 'and' or 'or' | |
$taxonomies=get_taxonomies($args,$output,$operator); | |
if ($taxonomies) { | |
foreach ($taxonomies as $taxonomy ) { | |
add_action ( $taxonomy.'_edit_form_fields', array($this,'extra_edit_tax_fields')); | |
add_action ( $taxonomy.'_add_form_fields', array($this,'extra_add_tax_fields')); | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment