delete_field

Delete_field().

Description

delete_field( (string) $field_name, $post_id ); 

This function will remove a value from the database

Parameters (2)

0. $field_name (string)
The field name.
1. $post_id
The post id.

Usage

  1. if ( !function_exists( 'delete_field' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'advanced-custom-fields/core/api.php'; 
  3.  
  4. // The field name. 
  5. $field_name = ''; 
  6.  
  7. // The post id. 
  8. $post_id = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = delete_field($field_name, $post_id); 
  12.  

Defined (1)

The function is defined in the following location(s).

/core/api.php  
  1. function delete_field( $field_name, $post_id ) 
  2. do_action('acf/delete_value', $post_id, $field_name );