public function delete()
{
global $wpdb;
$where = array('id' => $this->get_id());
$where_format = array('%d');
$result = $wpdb->delete($wpdb->dmtable, $where, $where_format);
if (empty($result)) {
return new \WP_Error('mercator.mapping.delete_failed');
}
// Update the cache
wp_cache_delete('id:' . $this->get_site_id(), 'domain_mapping');
wp_cache_delete('domain:' . $this->get_domain(), 'domain_mapping');
/**
* Fires after a mapping has been delete.
*
* @param Mercator\Mapping $mapping The mapping object.
*/
do_action('mercator.mapping.deleted', $this);
return true;
}