catchresponsive_sanitize_category_list

Sanitizes category list in slider.

Description

catchresponsive_sanitize_category_list( $input ); 

Parameters (1)

0. $input
Entered value

Usage

  1. if ( !function_exists( 'catchresponsive_sanitize_category_list' ) ) { 
  2. require_once '/inc/customizer-includes/catchresponsive-customizer-sanitize-functions.php'; 
  3.  
  4. // entered value 
  5. $input = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = catchresponsive_sanitize_category_list($input); 
  9.  

Defined (1)

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

/inc/customizer-includes/catchresponsive-customizer-sanitize-functions.php  
  1. function catchresponsive_sanitize_category_list( $input ) { 
  2. if ( '' != $input ) { 
  3. $args = array( 
  4. 'type' => 'post',  
  5. 'child_of' => 0,  
  6. 'parent' => '',  
  7. 'orderby' => 'name',  
  8. 'order' => 'ASC',  
  9. 'hide_empty' => 0,  
  10. 'hierarchical' => 0,  
  11. 'taxonomy' => 'category',  
  12. ); 
  13.  
  14. $categories = ( get_categories( $args ) ); 
  15.  
  16. $category_list = array(); 
  17.  
  18. foreach ( $categories as $category ) 
  19. $category_list = array_merge( $category_list, array( $category->term_id ) ); 
  20.  
  21. if ( count( array_intersect( $input, $category_list ) ) == count( $input ) ) { 
  22. return $input; 
  23. else { 
  24. return ''; 
  25. else { 
  26. return '';