dongzhiyi2006 2014-12-11 07:02
浏览 48

从Windows Live Writer保存帖子时,wp_set_object_terms无法正常工作

I have a function attached to a save_post post in the following method

function save_post_fn( $post_id ) {
  wp_set_object_terms($post_id, 'Videos', 'category', true);
} 

add_action('save_post', 'save_post_fn', '1000' );

When I create / update a post from WordPress' editor, it adds the category correctly. If I create a post from Windows Live Writer, it does not add the category to the post. I've tried the following:

  1. Changing the hook: post_publish, edit_post, insert post data etc.
  2. I've tried various priorities default, -1000, 0, 100, 1000

Any ideas?

  • 写回答

1条回答 默认 最新

  • dongzong7467 2014-12-15 07:22
    关注

    Turns out WLW sends 2 sets of xmlrpc data. 1 just for categories. Have to catch the second round, or use a scheduled event and delay for 500ms.

    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?