classes/PodsAPI.php
public function delete_object_from_relationships( $id, $object, $name = null ) {

		/**
		 * @var $pods_init \PodsInit
		 */
		global $pods_init;

		$pod = false;

		// Run any bidirectional delete operations
		if ( is_array( $object ) ) {
			$pod = $object;
		} elseif ( is_object( $pods_init ) ) {
			$pod = PodsInit::$meta->get_object( $object, $name );
		}

		if ( ! empty( $pod ) ) {
			$object = $pod['type'];
			$name   = $pod['name'];

			foreach ( $pod['fields'] as $field ) {
				PodsForm::delete( $field['type'], $id, $field['name'], array_merge( $field, $field['options'] ), $pod );
			}
		}

		// Lookup related fields (non-bidirectional)
		$params = array(
			'where' => array(
				array(
					'key'   => 'type',
					'value' => 'pick'
				),
				array(
					'key'   => 'pick_object',
					'value' => $object
				)
			)
		);

		if ( ! empty( $name ) && $name !== $object ) {
			$params['where'][] = array(
				'key'   => 'pick_val',
				'value' => $name
			);
		}

		$fields = $this->load_fields( $params, false );

		if ( ! empty( $pod ) && 'media' === $pod['type'] ) {
			$params['where'] = array(
				array(
					'key'   => 'type',
					'value' => 'file'
				)
			);

			$fields = array_merge( $fields, $this->load_fields( $params, false ) );
		}

		if ( is_array( $fields ) && ! empty( $fields ) ) {
			foreach ( $fields as $related_field ) {
				$related_pod = $this->load_pod( array( 'id' => $related_field['pod_id'], 'fields' => false ), false );

				if ( empty( $related_pod ) ) {
					continue;
				}

				$related_from = $this->lookup_related_items_from( $related_field['id'], $related_pod['id'], $id, $related_field, $related_pod );

				$this->delete_relationships( $related_from, $id, $related_pod, $related_field );
			}
		}

		if ( ! empty( $pod ) && ! pods_tableless() ) {
			pods_query( "
				DELETE FROM `@wp_podsrel`
				WHERE
				(
					`pod_id` = %d
					AND `item_id` = %d
				)
				OR (
					`related_pod_id` = %d
					AND `related_item_id` = %d
				)
			", array(
				$pod['id'],
				$id,

				$pod['id'],
				$id
			) );
		}

		return true;
	}
public function delete_object_from_relationships( $id, $object, $name = null ) {

		/**
		 * @var $pods_init \PodsInit
		 */
		global $pods_init;

		$pod = false;

		// Run any bidirectional delete operations
		if ( is_array( $object ) ) {
			$pod = $object;
		} elseif ( is_object( $pods_init ) ) {
			$pod = PodsInit::$meta->get_object( $object, $name );
		}

		if ( ! empty( $pod ) ) {
			$object = $pod['type'];
			$name   = $pod['name'];

			foreach ( $pod['fields'] as $field ) {
				PodsForm::delete( $field['type'], $id, $field['name'], array_merge( $field, $field['options'] ), $pod );
			}
		}

		// Lookup related fields (non-bidirectional)
		$params = array(
			'where' => array(
				array(
					'key'   => 'type',
					'value' => 'pick'
				),
				array(
					'key'   => 'pick_object',
					'value' => $object
				)
			)
		);

		if ( ! empty( $name ) && $name !== $object ) {
			$params['where'][] = array(
				'key'   => 'pick_val',
				'value' => $name
			);
		}

		$fields = $this->load_fields( $params, false );

		if ( ! empty( $pod ) && 'media' === $pod['type'] ) {
			$params['where'] = array(
				array(
					'key'   => 'type',
					'value' => 'file'
				)
			);

			$fields = array_merge( $fields, $this->load_fields( $params, false ) );
		}

		if ( is_array( $fields ) && ! empty( $fields ) ) {
			foreach ( $fields as $related_field ) {
				$related_pod = $this->load_pod( array( 'id' => $related_field['pod_id'], 'fields' => false ), false );

				if ( empty( $related_pod ) ) {
					continue;
				}

				$related_from = $this->lookup_related_items_from( $related_field['id'], $related_pod['id'], $id, $related_field, $related_pod );

				$this->delete_relationships( $related_from, $id, $related_pod, $related_field );
			}
		}

		if ( ! empty( $pod ) && ! pods_tableless() ) {
			pods_query( "
				DELETE FROM `@wp_podsrel`
				WHERE
				(
					`pod_id` = %d
					AND `item_id` = %d
				)
				OR (
					`related_pod_id` = %d
					AND `related_item_id` = %d
				)
			", array(
				$pod['id'],
				$id,

				$pod['id'],
				$id
			) );
		}

		return true;
	}
public function delete_object_from_relationships ( $ id , $ object , $ name = null ) { /**
		 * @var $pods_init \PodsInit
		 */ global $ pods_init ; $ pod = false ; // Run any bidirectional delete operations if ( is_array ( $ object ) ) { $ pod = $ object ; } elseif ( is_object ( $ pods_init ) ) { $ pod = PodsInit :: $ meta -> get_object ( $ object , $ name ) ; } if ( ! empty ( $ pod ) ) { $ object = $ pod [ 'type' ] ; $ name = $ pod [ 'name' ] ; foreach ( $ pod [ 'fields' ] as $ field ) { PodsForm :: delete ( $ field [ 'type' ] , $ id , $ field [ 'name' ] , array_merge ( $ field , $ field [ 'options' ] ) , $ pod ) ; } } // Lookup related fields (non-bidirectional) $ params = array ( 'where' => array ( array ( 'key' => 'type' , 'value' => 'pick' ) , array ( 'key' => 'pick_object' , 'value' => $ object ) ) ) ; if ( ! empty ( $ name ) && $ name !== $ object ) { $ params [ 'where' ] [ ] = array ( 'key' => 'pick_val' , 'value' => $ name ) ; } $ fields = $ this -> load_fields ( $ params , false ) ; if ( ! empty ( $ pod ) && 'media' === $ pod [ 'type' ] ) { $ params [ 'where' ] = array ( array ( 'key' => 'type' , 'value' => 'file' ) ) ; $ fields = array_merge ( $ fields , $ this -> load_fields ( $ params , false ) ) ; } if ( is_array ( $ fields ) && ! empty ( $ fields ) ) { foreach ( $ fields as $ related_field ) { $ related_pod = $ this -> load_pod ( array ( 'id' => $ related_field [ 'pod_id' ] , 'fields' => false ) , false ) ; if ( empty ( $ related_pod ) ) { continue ; } $ related_from = $ this -> lookup_related_items_from ( $ related_field [ 'id' ] , $ related_pod [ 'id' ] , $ id , $ related_field , $ related_pod ) ; $ this -> delete_relationships ( $ related_from , $ id , $ related_pod , $ related_field ) ; } } if ( ! empty ( $ pod ) && ! pods_tableless ( ) ) { pods_query ( "
				DELETE FROM `@wp_podsrel`
				WHERE
				(
					`pod_id` = %d
					AND `item_id` = %d
				)
				OR (
					`related_pod_id` = %d
					AND `related_item_id` = %d
				)
			" , array ( $ pod [ 'id' ] , $ id , $ pod [ 'id' ] , $ id ) ) ; } return true ; }
Delete an object from tableless fields

@param int    $id
@param string $type
@param string $name

@return bool

@since 2.3.0
Delete an object from tableless fields