I want to import products by XML but the products has ids at the and of the titles,
here is a short title for example: “Levis bootcut jean 5450313”,
the id is “5450313”,
how can i Exclude product ids and import a clear title: “Levis bootcut jean”,
i have an example function but i don't know how to modify for my case:
function my_fix_title( $title ) {
$title = explode( ' ', $title );
array_pop( $title );
return implode( ' ', $title ); }
Wp All Import call the function like this: [my_fix_title({product_name[1]})]
Regards
array_pop delete the last element of the array and return it. So we can simply catch the return value from array_pop and send it back to the caller function. Please try followingUPDATES: Since the OP had an issue with the cache and the method he has worked fine, this answer is no longer valid.