I get this string "Holder – 2pcs"
from my Wordpress post title using the get_the_title()
function then I use str_replace
to replace the "–" character but no luck!
str_replace("–","-","Holder – 2pcs");
any help appreciated!
Edit:
(Response to comments)
I had to save the text from $title1=get_the_title();
to .txt
file and I noticed that the – saved as –
in the txt file ... then I replaced str_replace("–","-","Holder – 2pcs")
and it works! the problem is that in my wordpress databse the title contains - char as it should but then when I use get_the_title();
function of wordpress in my code to retrieve the title I get the - char as – which is eventually –
I dont know why get_the_title();
causing this issue!
Any thoughts?