Remove span tags from WooCommerce Downloads page

Remember that str_replace looks for an exact match of the ‘needle’ (what you are searching for; ‘haystack’ is the thing you are searching inside). So your code is not finding an exact match.

If you want to do a ‘replace everything that might be within the span codes in that hunk of text’, then a regex statement might be in order. This is assuming that the ‘haystack’ you are searching is different each time. (Since I don’t read your language, can’t tell for sure.

But, assuming that $download['donload_name'] contains the start and stop span tag, and something in the middle, then try to do two str_replace commands: one for the <span> and one for </span>.

And that assumes that there aren’t any parameters to the <span>. If there are, a regex might be better idea.

tech