1. Home
  2. Docs
  3. Simpods MVC
  4. Tutorials
  5. Featured Methods
  6. simpods_delete()

simpods_delete()

simpods_delete will delete data from the target database table, also those in relationship. For example, if you delete an item from a table created by Pods Framework, Pods’ delete function will be used and delete anythings saved in Pods tables and the WordPress ones. If it is a post type but not created by Pods, wp_delete_post will be used. Otherwise, custom code will be used to do the delete. In the future, it will be able to delete related data inserted by Simpods components.

Parameters

simpods_delete accepts four parameters:

simpods_delete( $table, $wheres, $can_echo_query = false, $can_prefix = true )
  • $table: the target table to update
  • $wheres: Pass in the fields and values in an associated array to insert, in this format: array(‘key’ => ‘value’). simpods_select will be used to located the item.
  • $can_echo_query: Default to false. If set to true, the SQL query will be displayed on the screen if it is not processed by Pods or WordPress, for debugging purpose.
  • $can_prefix: Default to true. If set to false, the function won’t automatically prefix $table_prefix to the ‘target_tb’ in the $atts_arr array. It is useful if you are querying a database table that are not designed for WordPress.

Return

This function will return an Boolean.