Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 钩入';保存自定义分类法';比如';保存post&x27;在WordPress中_Php_Wordpress_Custom Taxonomy_Wordpress Hook - Fatal编程技术网

Php 钩入';保存自定义分类法';比如';保存post&x27;在WordPress中

Php 钩入';保存自定义分类法';比如';保存post&x27;在WordPress中,php,wordpress,custom-taxonomy,wordpress-hook,Php,Wordpress,Custom Taxonomy,Wordpress Hook,是否可以在编辑/保存自定义分类术语(事先未知)(最好是自定义分类子术语)时挂接函数,就像保存帖子或页面时挂接save_post一样 保存分类术语时要执行的操作: function generate_pdf($slug) { wp_remote_get( etc... ); } 编辑: 似乎编辑${taxonomy}是我需要的东西,但我似乎无法将$term\u slug推入函数: function pdf_save_magazine($term_id, $tt_id, $taxonomy

是否可以在编辑/保存自定义分类术语(事先未知)(最好是自定义分类子术语)时挂接函数,就像保存帖子或页面时挂接save_post一样

保存分类术语时要执行的操作:

function generate_pdf($slug) {
    wp_remote_get( etc... );
}
编辑:

似乎编辑${taxonomy}是我需要的东西,但我似乎无法将$term\u slug推入函数:

function pdf_save_magazine($term_id, $tt_id, $taxonomy) {
    $term = get_term($term_id, $tt_id);
    $term_slug = $term->slug;
    wp_remote_get(
        'http://url-that-saves-pdf.com/?print='.$term_slug,
         array(
             'blocking' => false,
             'timeout' => 1,
             'httpversion' => '1.1'
          )
    );
}
add_action( 'edit_auteur', 'pdf_save_magazine', $term_id, $tt_id, $taxonomy );

回答我自己的问题:

这项工作:

function pdf_save_magazine($term_id, $tt_id, $taxonomy) {
   $term = get_term($term_id, $taxonomy);
   $term_slug = $term->slug;
    wp_remote_get(
      'http://url-that-saves-pdf.com/?print='.$term_slug,
      array(
         'blocking' => false,
         'timeout' => 1,
         'httpversion' => '1.1'
      )
   );
}
add_action( 'edit_term', 'pdf_save_magazine', 10, 3 );

你挂的钩子可能是“编辑的”。请注意过去式“ed”。您可以在这里查看: