wppaste
WordPress

wp_xmlrpc_server::wp_deleteTerm( array $args ): true|IXR_Error

Since
3.4.0
Source
wp-includes/class-wp-xmlrpc-server.php:2311
Deletes a term.

Parameters

$argsarray
Method arguments. Note: arguments must be ordered as documented.
  • $0int

    Blog ID (unused).
  • $1string

    Username.
  • $2string

    Password.
  • $3string

    Taxonomy name.
  • $4int

    Term ID.

Return

true|IXR_Error
True on success, IXR_Error instance on failure.

Hooks fired · 1

One hook fires while wp_xmlrpc_server::wp_deleteTerm() runs, in this order:

  1. do_action( xmlrpc_call )actionline 2329 (+18 into the body)

    Fires after the XML-RPC user has been authenticated but before the rest of the method logic begins.

Uses · 12

Source

	public function wp_deleteTerm( $args ) {		if ( ! $this->minimum_args( $args, 5 ) ) {			return $this->error;		} 		$this->escape( $args ); 		$username = $args[1];		$password = $args[2];		$taxonomy = $args[3];		$term_id  = (int) $args[4]; 		$user = $this->login( $username, $password );		if ( ! $user ) {			return $this->error;		} 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */		do_action( 'xmlrpc_call', 'wp.deleteTerm', $args, $this ); 		if ( ! taxonomy_exists( $taxonomy ) ) {			return new IXR_Error( 403, __( 'Invalid taxonomy.' ) );		} 		$taxonomy = get_taxonomy( $taxonomy );		$term     = get_term( $term_id, $taxonomy->name ); 		if ( is_wp_error( $term ) ) {			return new IXR_Error( 500, $term->get_error_message() );		} 		if ( ! $term ) {			return new IXR_Error( 404, __( 'Invalid term ID.' ) );		} 		if ( ! current_user_can( 'delete_term', $term_id ) ) {			return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this term.' ) );		} 		$result = wp_delete_term( $term_id, $taxonomy->name ); 		if ( is_wp_error( $result ) ) {			return new IXR_Error( 500, $result->get_error_message() );		} 		if ( ! $result ) {			return new IXR_Error( 500, __( 'Sorry, deleting the term failed.' ) );		} 		return $result;	}

History

Introduced in 3.4.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/class-wp-xmlrpc-server.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.