esc_url removes white space. Can I change that to using ‘-‘? olatechproFebruary 22, 20230 Views I’m using esc_url to sanitize my url. The only problem is that “my link” becomes “mylink”. I wouldreally like it to become “my-link”. Is there a way to change this? Post Views: 0 Related postsGet rid of this Strict Standards warningWooCommerce: get_current_screen not working with multi languageCan’t login on WordPressForce HTTPS using .htaccess – stuck in redirect loopWordPress: Ajax not working to insert, query and result dataHow Can I pass an image file to wp_handle_upload?
$url = esc_url ( str_replace(' ' , '-', $url ) ); Replace the spaces to – chars before activating esc_url function, and your problem is solved. Log in to Reply
Replace the spaces to – chars before activating esc_url function, and your problem is solved.