classes/PodsAPI.php
public function delete_pod( $params, $strict = false, $delete_all = false ) {

		/**
		 * @var $wpdb wpdb
		 */
		global $wpdb;

		if ( ! is_object( $params ) && ! is_array( $params ) ) {
			if ( is_numeric( $params ) ) {
				$params = array( 'id' => $params );
			} else {
				$params = array( 'name' => $params );
			}

			$params = (object) pods_sanitize( $params );
		} else {
			$params = (object) pods_sanitize( $params );
		}

		if ( ! isset( $params->delete_all ) ) {
			$params->delete_all = $delete_all;
		}

		$params->table_info = false;

		$pod = $this->load_pod( $params, $strict );

		if ( empty( $pod ) ) {
			if ( false !== $strict ) {
				return pods_error( __( 'Pod not found', 'pods' ), $this );
			}

			return false;
		}

		$params->id   = (int) $pod['id'];
		$params->name = $pod['name'];

		// Reset content
		if ( true === $params->delete_all ) {
			$this->reset_pod( $params, $pod );
		}

		foreach ( $pod['fields'] as $field ) {
			$field['pod'] = $pod;

			$this->delete_field( $field, false );
		}

		// Only delete the post once the fields are taken care of, it's not required anymore
		$success = wp_delete_post( $params->id );

		if ( ! $success ) {
			return pods_error( __( 'Pod unable to be deleted', 'pods' ), $this );
		}

		if ( ! pods_tableless() ) {
			if ( 'table' === $pod['storage'] ) {
				try {
					pods_query( "DROP TABLE IF EXISTS `@wp_pods_{$params->name}`", false );
				} catch ( Exception $e ) {
					// Allow pod to be deleted if the table doesn't exist
					if ( false === strpos( $e->getMessage(), 'Unknown table' ) ) {
						return pods_error( $e->getMessage(), $this );
					}
				}
			}

			pods_query( "DELETE FROM `@wp_podsrel` WHERE `pod_id` = {$params->id} OR `related_pod_id` = {$params->id}", false );
		}

		// @todo Delete relationships from tableless relationships

		// Delete any relationship references
		$sql = "
			DELETE `pm`
			FROM `{$wpdb->postmeta}` AS `pm`
			LEFT JOIN `{$wpdb->posts}` AS `p`
				ON `p`.`post_type` = '_pods_field'
					AND `p`.`ID` = `pm`.`post_id`
			LEFT JOIN `{$wpdb->postmeta}` AS `pm2`
				ON `pm2`.`meta_key` = 'pick_object'
					AND `pm2`.`meta_value` = 'pod'
					AND `pm2`.`post_id` = `pm`.`post_id`
			WHERE
				`p`.`ID` IS NOT NULL
				AND `pm2`.`meta_id` IS NOT NULL
				AND `pm`.`meta_key` = 'pick_val'
				AND `pm`.`meta_value` = '{$params->name}'
		";

		pods_query( $sql );

		$this->cache_flush_pods( $pod );

		return true;
	}
public function delete_pod( $params, $strict = false, $delete_all = false ) {

		/**
		 * @var $wpdb wpdb
		 */
		global $wpdb;

		if ( ! is_object( $params ) && ! is_array( $params ) ) {
			if ( is_numeric( $params ) ) {
				$params = array( 'id' => $params );
			} else {
				$params = array( 'name' => $params );
			}

			$params = (object) pods_sanitize( $params );
		} else {
			$params = (object) pods_sanitize( $params );
		}

		if ( ! isset( $params->delete_all ) ) {
			$params->delete_all = $delete_all;
		}

		$params->table_info = false;

		$pod = $this->load_pod( $params, $strict );

		if ( empty( $pod ) ) {
			if ( false !== $strict ) {
				return pods_error( __( 'Pod not found', 'pods' ), $this );
			}

			return false;
		}

		$params->id   = (int) $pod['id'];
		$params->name = $pod['name'];

		// Reset content
		if ( true === $params->delete_all ) {
			$this->reset_pod( $params, $pod );
		}

		foreach ( $pod['fields'] as $field ) {
			$field['pod'] = $pod;

			$this->delete_field( $field, false );
		}

		// Only delete the post once the fields are taken care of, it's not required anymore
		$success = wp_delete_post( $params->id );

		if ( ! $success ) {
			return pods_error( __( 'Pod unable to be deleted', 'pods' ), $this );
		}

		if ( ! pods_tableless() ) {
			if ( 'table' === $pod['storage'] ) {
				try {
					pods_query( "DROP TABLE IF EXISTS `@wp_pods_{$params->name}`", false );
				} catch ( Exception $e ) {
					// Allow pod to be deleted if the table doesn't exist
					if ( false === strpos( $e->getMessage(), 'Unknown table' ) ) {
						return pods_error( $e->getMessage(), $this );
					}
				}
			}

			pods_query( "DELETE FROM `@wp_podsrel` WHERE `pod_id` = {$params->id} OR `related_pod_id` = {$params->id}", false );
		}

		// @todo Delete relationships from tableless relationships

		// Delete any relationship references
		$sql = "
			DELETE `pm`
			FROM `{$wpdb->postmeta}` AS `pm`
			LEFT JOIN `{$wpdb->posts}` AS `p`
				ON `p`.`post_type` = '_pods_field'
					AND `p`.`ID` = `pm`.`post_id`
			LEFT JOIN `{$wpdb->postmeta}` AS `pm2`
				ON `pm2`.`meta_key` = 'pick_object'
					AND `pm2`.`meta_value` = 'pod'
					AND `pm2`.`post_id` = `pm`.`post_id`
			WHERE
				`p`.`ID` IS NOT NULL
				AND `pm2`.`meta_id` IS NOT NULL
				AND `pm`.`meta_key` = 'pick_val'
				AND `pm`.`meta_value` = '{$params->name}'
		";

		pods_query( $sql );

		$this->cache_flush_pods( $pod );

		return true;
	}
public function delete_pod ( $ params , $ strict = false , $ delete_all = false ) { /**
		 * @var $wpdb wpdb
		 */ global $ wpdb ; if ( ! is_object ( $ params ) && ! is_array ( $ params ) ) { if ( is_numeric ( $ params ) ) { $ params = array ( 'id' => $ params ) ; } else { $ params = array ( 'name' => $ params ) ; } $ params = ( object ) pods_sanitize ( $ params ) ; } else { $ params = ( object ) pods_sanitize ( $ params ) ; } if ( ! isset ( $ params -> delete_all ) ) { $ params -> delete_all = $ delete_all ; } $ params -> table_info = false ; $ pod = $ this -> load_pod ( $ params , $ strict ) ; if ( empty ( $ pod ) ) { if ( false !== $ strict ) { return pods_error ( __ ( 'Pod not found' , 'pods' ) , $ this ) ; } return false ; } $ params -> id = ( int ) $ pod [ 'id' ] ; $ params -> name = $ pod [ 'name' ] ; // Reset content if ( true === $ params -> delete_all ) { $ this -> reset_pod ( $ params , $ pod ) ; } foreach ( $ pod [ 'fields' ] as $ field ) { $ field [ 'pod' ] = $ pod ; $ this -> delete_field ( $ field , false ) ; } // Only delete the post once the fields are taken care of, it's not required anymore $ success = wp_delete_post ( $ params -> id ) ; if ( ! $ success ) { return pods_error ( __ ( 'Pod unable to be deleted' , 'pods' ) , $ this ) ; } if ( ! pods_tableless ( ) ) { if ( 'table' === $ pod [ 'storage' ] ) { try { pods_query ( "DROP TABLE IF EXISTS `@wp_pods_{$params->name}`" , false ) ; } catch ( Exception $ e ) { // Allow pod to be deleted if the table doesn't exist if ( false === strpos ( $ e -> getMessage ( ) , 'Unknown table' ) ) { return pods_error ( $ e -> getMessage ( ) , $ this ) ; } } } pods_query ( "DELETE FROM `@wp_podsrel` WHERE `pod_id` = {$params->id} OR `related_pod_id` = {$params->id}" , false ) ; } // @todo Delete relationships from tableless relationships // Delete any relationship references $ sql = "
			DELETE `pm`
			FROM `{$wpdb->postmeta}` AS `pm`
			LEFT JOIN `{$wpdb->posts}` AS `p`
				ON `p`.`post_type` = '_pods_field'
					AND `p`.`ID` = `pm`.`post_id`
			LEFT JOIN `{$wpdb->postmeta}` AS `pm2`
				ON `pm2`.`meta_key` = 'pick_object'
					AND `pm2`.`meta_value` = 'pod'
					AND `pm2`.`post_id` = `pm`.`post_id`
			WHERE
				`p`.`ID` IS NOT NULL
				AND `pm2`.`meta_id` IS NOT NULL
				AND `pm`.`meta_key` = 'pick_val'
				AND `pm`.`meta_value` = '{$params->name}'
		" ; pods_query ( $ sql ) ; $ this -> cache_flush_pods ( $ pod ) ; return true ; }
Delete a Pod and all its content

$params['id'] int The Pod ID
$params['name'] string The Pod name

@param array $params     An associative array of parameters
@param bool  $strict     (optional) Makes sure a pod exists, if it doesn't throws an error
@param bool  $delete_all (optional) Whether to delete all content from a WP object

@uses  PodsAPI::load_pod
@uses  wp_delete_post
@uses  pods_query

@return bool
@since 1.7.9
Delete a Pod and all its content