wp-admin/includes/ajax-actions.php:1040Handles adding a link category via AJAX.
$actionstringfunction wp_ajax_add_link_category( $action ) { if ( empty( $action ) ) { $action = 'add-link-category'; } check_ajax_referer( $action ); $taxonomy_object = get_taxonomy( 'link_category' ); if ( ! current_user_can( $taxonomy_object->cap->manage_terms ) ) { wp_die( -1 ); } $names = explode( ',', wp_unslash( $_POST['newcat'] ) ); $response = new WP_Ajax_Response(); foreach ( $names as $category_name ) { $category_name = trim( $category_name ); $slug = sanitize_title( $category_name ); if ( '' === $slug ) { continue; } $category_id = wp_insert_term( $category_name, 'link_category' ); if ( ! $category_id || is_wp_error( $category_id ) ) { continue; } else { $category_id = $category_id['term_id']; } $category_name = esc_html( $category_name ); $response->add( array( 'what' => 'link-category', 'id' => $category_id, 'data' => "<li id='link-category-$category_id'><label for='in-link-category-$category_id' class='selectit'><input value='" . esc_attr( $category_id ) . "' type='checkbox' checked='checked' name='link_category[]' id='in-link-category-$category_id'/> $category_name</label></li>", 'position' => -1, ) ); } $response->send();}Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-admin/includes/ajax-actions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.