responsive_II_save_layout_post_metadata

Validate, sanitize, and save post metadata.

Description

responsive_II_save_layout_post_metadata(); 

Validates the user-submitted post custom meta data, ensuring that the selected layout option is in the array of valid layout options; otherwise, it returns default..


Usage

  1. if ( !function_exists( 'responsive_II_save_layout_post_metadata' ) ) { 
  2. require_once '/includes/functions-layout.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = responsive_II_save_layout_post_metadata(); 
  7.  

Defined (1)

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

/includes/functions-layout.php  
  1. function responsive_II_save_layout_post_metadata() { 
  2. global $post; 
  3. if ( !isset( $post ) || !is_object( $post ) ) { 
  4. return; 
  5. $valid_layouts = responsive_II_valid_layouts(); 
  6. $layout = ( isset( $_POST['_responsive_II_layout'] ) && array_key_exists( $_POST['_responsive_II_layout'], $valid_layouts ) ? $_POST['_responsive_II_layout'] : 'default' ); 
  7.  
  8. update_post_meta( $post->ID, '_responsive_II_layout', $layout );