phpwordpresshookwindows-live-writer

wp_set_object_terms not working when post saved from Windows Live Writer


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?


Solution

  • 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.