Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 37 lines (25 sloc) 0.715 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
<?php
require_once('../wp-config.php');
require_once('admin-functions.php');
require_once('admin-db.php');

get_currentuserinfo();

if ( !current_user_can('manage_categories') )
die('-1');

function get_out_now() { exit; }

add_action('shutdown', 'get_out_now', -1);

$names = explode(',', rawurldecode($_GET['ajaxnewcat']) );
$ids = array();

foreach ($names as $cat_name) {
$cat_name = trim( $cat_name );

if ( !$category_nicename = sanitize_title($cat_name) )
continue;
if ( $already = category_exists($cat_name) ) {
$ids[] = (string) $already;
continue;
}

$new_cat_id = wp_create_category($cat_name);

$ids[] = (string) $new_cat_id;
}

$return = join(',', $ids);

die( (string) $return );

?>
Something went wrong with that request. Please try again.