nf_get_object_meta_value

Function that gets a piece of object meta.

Description

nf_get_object_meta_value( (string) $object_id, (string) $meta_key ); 

Parameters (2)

0. $object_id (string)
The object id.
1. $meta_key (string)
The meta key.

Usage

  1. if ( !function_exists( 'nf_get_object_meta_value' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/functions.php'; 
  3.  
  4. // The object id. 
  5. $object_id = ''; 
  6.  
  7. // The meta key. 
  8. $meta_key = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = nf_get_object_meta_value($object_id, $meta_key); 
  12.  

Defined (1)

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

/deprecated/includes/functions.php  
  1. function nf_get_object_meta_value( $object_id, $meta_key ) { 
  2. global $wpdb; 
  3.  
  4. $meta_value = $wpdb->get_row( $wpdb->prepare( 'SELECT meta_value FROM ' . NF_OBJECT_META_TABLE_NAME . ' WHERE object_id = %d AND meta_key = %s', $object_id, $meta_key ), ARRAY_A ); 
  5. if ( is_array ( $meta_value['meta_value'] ) ) { 
  6. $meta_value['meta_value'] = unserialize( $meta_value['meta_value'] ); 
  7.  
  8. return $meta_value['meta_value'];