wc_correios_sanitize_postcode

Sanitize postcode.

Description

(string) wc_correios_sanitize_postcode( (string) $postcode ); 

Returns (string)

Parameters (1)

0. $postcode (string)
The postcode.

Usage

  1. if ( !function_exists( 'wc_correios_sanitize_postcode' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-correios/includes/wc-correios-functions.php'; 
  3.  
  4. // The postcode. 
  5. $postcode = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wc_correios_sanitize_postcode($postcode); 
  9.  

Defined (1)

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

/includes/wc-correios-functions.php  
  1. function wc_correios_sanitize_postcode( $postcode ) { 
  2. return preg_replace( '([^0-9])', '', sanitize_text_field( $postcode ) );