Variable Visions

Articles PHP PHP-preg-replace-for-adding-hyphens-to-URL-field

tutorials - PHP and Web-Development.

PHP preg_replace for adding hyphens to URL field

Published Thu. Aug. 02, 2012

Set this variable eqaul to your POST value for URL title and it will automatically add hyphens where spaces are found.

$urltitle = preg_replace('/[^A-Za-z0-9-]+/', '-', $urltitle);

Tag(s): PHP, preg_replace, query string urls


PUBLISHED ON 03.3.20arrowWordpress and Woocommerce widget for inserting PHP in Elementor

PUBLISHED ON 09.5.19arrowWordpress and Woocommerce redirect to a product page from categories with a single product