Reputation: 39
I have this line of code in WordPress:
a href="http://domain.com/<?php echo $member['ut_member_name']; ?>"
I want it to displace the field WITHOUT any of the spaces.
For example: http://domain.com/tomjones
The field is originally saved as "Tom Jones".
Any idea how I can do this...??
Thanx in advance.
Upvotes: 0
Views: 2696
Reputation: 281
You may use the existing wordpress functions. Check at below link:
http://codex.wordpress.org/Function_Reference/sanitize_title_with_dashes
Upvotes: 0
Reputation:
try str_replace
$member_name = str_replace(" ","", $member['ut_member_name']);
Upvotes: 1
Reputation: 26844
How about this? strtolower(str_replace(" ","", $member['ut_member_name']));
This will remove all space and make all characters to lowercase.
Upvotes: 1