Sanitize title with dashes

Posted on: December 21st, 2022
By: Tadeo Martinez

$sectionID = get_sub_field('title'); 
$sanitizedID = sanitize_title_with_dashes($SectionID);
echo $sanitizedID;

To remove any numbers from the ID, add the following code:

// Remove numbers from the ID
$ID = preg_replace('/\d+/', '', $ID);

Have any questions or comments? Write them below!


Leave a Reply

Your email address will not be published. Required fields are marked *