Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
Function to get variable content and strip variable to only return numbers

Attempting to extract the shipping tracking number from the content of a Woocommerce note to customer to eventually pass to a custom field as a value

Original function

    function get_value( $comment, $parameters ) {
    return $comment->content;
}

Modified function (not working)

function get_value( $comment, $parameters ) {
    $tracking_note = $comment->content;
    $new_output = preg_replace( '/[^0-9]/', '', $tracking_note );
    return $new_output->content;
    
}
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

preg_replace will not return an object, also refer to: https://www.php.net/manual/en/function.preg-replace.php.

Just return the variable like: return $new_output;

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda