pods_register_field

Add a new Pod field outside of the DB.

Description

(array|boolean) pods_register_field( (string|array) $pod, (string) $name, (null) $field = null ); 

Returns (array|boolean)

Field data or false if unsuccessful

Parameters (3)

0. $pod (string|array)
The pod name or array of pod names
1. $name (string)
The name of the Pod
2. $field — Optional. (null) => null
Pod array, including any fields arrays

Usage

  1. if ( !function_exists( 'pods_register_field' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'pods-custom-content-types-and-fields/includes/general.php'; 
  3.  
  4. // The pod name or array of pod names 
  5. $pod = null; 
  6.  
  7. // The name of the Pod 
  8. $name = ''; 
  9.  
  10. // (optional) Pod array, including any 'fields' arrays 
  11. $field = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = pods_register_field($pod, $name, $field); 
  15.  

Defined (1)

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

/includes/general.php  
  1. function pods_register_field ( $pod, $name, $field = null ) { 
  2. if ( empty( $field ) ) 
  3. $field = array(); 
  4.  
  5. if ( !empty( $name ) ) 
  6. $field[ 'name' ] = $name; 
  7.  
  8. return pods_meta()->register_field( $pod, $field );