Make WordPress Core


Ignore:
Timestamp:
03/16/2008 08:37:02 PM (16 years ago)
Author:
ryan
Message:

Don't allow duplicate category creation. Props westi and mdawaffe. fixes #3799

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r7162 r7336  
    247247    }
    248248
     249    if ( category_exists( trim( $_POST['cat_name'] ) ) ) {
     250        $x = new WP_Ajax_Response( array(
     251            'what' => 'cat',
     252            'id' => new WP_Error( 'cat_exists', __('The category you are trying to create already exists.'), array( 'form-field' => 'cat_name' ) ),
     253        ) );
     254        $x->send();
     255    }
     256   
    249257    $cat = wp_insert_category( $_POST, true );
    250258
Note: See TracChangeset for help on using the changeset viewer.