public function metaWeblog_newPost($args, $post) { if (empty($args['categories'][0])) { return; } # if we don't have it, then leave. $category = Category::getCategoryIDbyName($args['categories'][0]); SQL::current()->insert("post_attributes", array("name" => "category_id", "value" => $category->id, "post_id" => $post->id)); }