Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!