<?php
/*
Plugin Name: Xml Write
Plugin URI: http://wordpress.org/plugins/
Description: This is post category xml write plugin
Version: 1.6
Author URI:
*/
add_action(\'admin_menu\', \'xmlwrite_admin_actions\');
function xmlwrite_admin_actions() {
add_options_page(\'xmlwrite\', \'xmlwrite\', \'manage_options\', xmlwrite, \'xmlwrite_admin\');
}
add_action(\'add_category_form_pre\', \'update_category_function\');
add_action(\'edit_category\', \'update_category_function\');
add_action(\'delete_category\', \'update_category_function\');
function update_category_function($category_id) {
$categories = get_categories($category_id);
$xml = new XMLWriter();
$xml->openURI("text.xml");
$xml->startDocument();
$xml->setIndent(true);
$xml->startElement(\'Categories\');
foreach ($categories as $category) {
$xml->startElement("Category");
$xml->writeRaw($category->name);
$xml->endElement();
$xml->startElement("url");
$xml->writeRaw(esc_url(get_category_link($category->term_id)));
$xml->endElement();
}
$xml->endElement();
header(\'Content-type: tet/xml\');
$xml->flush();
}