Title: wp_ajax_inline_save_tax
Published: April 25, 2014
Last modified: August 20, 2026

---

# wp_ajax_inline_save_tax()

## In this article

 * [Source](https://developer.wordpress.org/reference/functions/wp_ajax_inline_save_tax/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_ajax_inline_save_tax/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_ajax_inline_save_tax/?output_format=md#changelog)

Handles Quick Edit saving for a term via AJAX.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_ajax_inline_save_tax/?output_format=md#source)󠁿

    ```php
    function wp_ajax_inline_save_tax() {
    	check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );

    	$taxonomy        = sanitize_key( $_POST['taxonomy'] );
    	$taxonomy_object = get_taxonomy( $taxonomy );

    	if ( ! $taxonomy_object ) {
    		wp_die( 0 );
    	}

    	if ( ! isset( $_POST['tax_ID'] ) || ! (int) $_POST['tax_ID'] ) {
    		wp_die( -1 );
    	}

    	$id = (int) $_POST['tax_ID'];

    	if ( ! current_user_can( 'edit_term', $id ) ) {
    		wp_die( -1 );
    	}

    	$wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => 'edit-' . $taxonomy ) );

    	$tag                  = get_term( $id, $taxonomy );
    	$_POST['description'] = $tag->description;

    	$updated = wp_update_term( $id, $taxonomy, $_POST );

    	if ( $updated && ! is_wp_error( $updated ) ) {
    		$tag = get_term( $updated['term_id'], $taxonomy );
    		if ( ! $tag || is_wp_error( $tag ) ) {
    			if ( is_wp_error( $tag ) && $tag->get_error_message() ) {
    				wp_die( $tag->get_error_message() );
    			}
    			wp_die( __( 'Item not updated.' ) );
    		}
    	} else {
    		if ( is_wp_error( $updated ) && $updated->get_error_message() ) {
    			wp_die( $updated->get_error_message() );
    		}
    		wp_die( __( 'Item not updated.' ) );
    	}

    	$level  = 0;
    	$parent = $tag->parent;

    	while ( $parent > 0 ) {
    		$parent_tag = get_term( $parent, $taxonomy );
    		$parent     = $parent_tag->parent;
    		++$level;
    	}

    	$wp_list_table->single_row( $tag, $level );
    	wp_die();
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-admin/includes/ajax-actions.php#L2206)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-admin/includes/ajax-actions.php#L2206-L2259)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_ajax_inline_save_tax/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_List_Table::single_row()](https://developer.wordpress.org/reference/classes/wp_list_table/single_row/)`wp-admin/includes/class-wp-list-table.php` |

Generates content for a single row of the table.

  | 
| [_get_list_table()](https://developer.wordpress.org/reference/functions/_get_list_table/)`wp-admin/includes/list-table.php` |

Fetches an instance of a [WP_List_Table](https://developer.wordpress.org/reference/classes/wp_list_table/) class.

  | 
| [wp_update_term()](https://developer.wordpress.org/reference/functions/wp_update_term/)`wp-includes/taxonomy.php` |

Updates term based on arguments provided.

  | 
| [current_user_can()](https://developer.wordpress.org/reference/functions/current_user_can/)`wp-includes/capabilities.php` |

Returns whether the current user has the specified capability.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [sanitize_key()](https://developer.wordpress.org/reference/functions/sanitize_key/)`wp-includes/formatting.php` |

Sanitizes a string key.

  | 
| [check_ajax_referer()](https://developer.wordpress.org/reference/functions/check_ajax_referer/)`wp-includes/pluggable.php` |

Verifies the Ajax request to prevent processing requests external of the blog.

  | 
| [wp_die()](https://developer.wordpress.org/reference/functions/wp_die/)`wp-includes/functions.php` |

Kills WordPress execution and displays HTML page with an error message.

  | 
| [get_taxonomy()](https://developer.wordpress.org/reference/functions/get_taxonomy/)`wp-includes/taxonomy.php` |

Retrieves the taxonomy object of $taxonomy.

  | 
| [get_term()](https://developer.wordpress.org/reference/functions/get_term/)`wp-includes/taxonomy.php` |

Gets all term data from database by term ID.

  | 
| [is_wp_error()](https://developer.wordpress.org/reference/functions/is_wp_error/)`wp-includes/load.php` |

Checks whether the given variable is a WordPress Error.

  |

[Show 8 more](https://developer.wordpress.org/reference/functions/wp_ajax_inline_save_tax/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_ajax_inline_save_tax/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_ajax_inline_save_tax/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_ajax_inline_save_tax%2F)
before being able to contribute a note or feedback.