WordPress replacing last space in title with  

May 28th, 2014
|

This is a weird issue that I recently stumbled across and couldn’t find documented anywhere. ¬†Wordpress was automatically replacing the last space in my titles with a non breaking space ( ). ¬†I actually ended up having to manually add a filter to the_title in order to remove it.

Here is my code:

function av_remove_nbsp( $title, $id ) {
    return str_replace(' ', ' ', $title);
}
add_filter('the_title', 'av_remove_nbsp', 10, 2);

Comments are closed.

Comments have been closed for this post. If you would like to ask a question or need help, please post in the forums.