Skip to main content
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
Source Link

I have found out that when i save post, there are "kind of" non breaking space saved, sometimes. I don't mind "regular  ". This can appear anywhere in the text.

In the editor, they are obviously not visible.

=> if i use the editor source tool, the space looks like regular space.

The problem is : on the site, they don't apprear so it's like the two words are without space at all.

If i check the source, i see   for these spaces.

I have already a lot of data saved, so i want to remove the nbspace with query :

I tried :

UPDATE `vss_posts` SET `post_content` = replace(`post_content`, " ", " ");

But it did nothing : the nbsp where still there.

i've seen this postthis post talking about hexa nbsp;

But obviously,

UPDATE `vss_posts` SET `post_content` = replace(`post_content`, "\xc2\xa0", " ");

doesn't work.

What could be the problem ? How can i remove them in the db ? How can i prevent them to be saved again ?

In the aforementionned post i saw this :

add_filter( 'wp_insert_post_data', 'rm_wp_insert_post_data', '99', 2 );
function rm_wp_insert_post_data ( $data , $postarr ) {
   return str_replace("\xc2\xa0", " ", $data); 
}

Does it apply to my problem ? (just for preventing, not for curing)

The only way i've found sofar is to manually edit the post, remove the space and recreate it with the space tab.

I have found out that when i save post, there are "kind of" non breaking space saved, sometimes. I don't mind "regular  ". This can appear anywhere in the text.

In the editor, they are obviously not visible.

=> if i use the editor source tool, the space looks like regular space.

The problem is : on the site, they don't apprear so it's like the two words are without space at all.

If i check the source, i see   for these spaces.

I have already a lot of data saved, so i want to remove the nbspace with query :

I tried :

UPDATE `vss_posts` SET `post_content` = replace(`post_content`, " ", " ");

But it did nothing : the nbsp where still there.

i've seen this post talking about hexa nbsp;

But obviously,

UPDATE `vss_posts` SET `post_content` = replace(`post_content`, "\xc2\xa0", " ");

doesn't work.

What could be the problem ? How can i remove them in the db ? How can i prevent them to be saved again ?

In the aforementionned post i saw this :

add_filter( 'wp_insert_post_data', 'rm_wp_insert_post_data', '99', 2 );
function rm_wp_insert_post_data ( $data , $postarr ) {
   return str_replace("\xc2\xa0", " ", $data); 
}

Does it apply to my problem ? (just for preventing, not for curing)

The only way i've found sofar is to manually edit the post, remove the space and recreate it with the space tab.

I have found out that when i save post, there are "kind of" non breaking space saved, sometimes. I don't mind "regular  ". This can appear anywhere in the text.

In the editor, they are obviously not visible.

=> if i use the editor source tool, the space looks like regular space.

The problem is : on the site, they don't apprear so it's like the two words are without space at all.

If i check the source, i see   for these spaces.

I have already a lot of data saved, so i want to remove the nbspace with query :

I tried :

UPDATE `vss_posts` SET `post_content` = replace(`post_content`, " ", " ");

But it did nothing : the nbsp where still there.

i've seen this post talking about hexa nbsp;

But obviously,

UPDATE `vss_posts` SET `post_content` = replace(`post_content`, "\xc2\xa0", " ");

doesn't work.

What could be the problem ? How can i remove them in the db ? How can i prevent them to be saved again ?

In the aforementionned post i saw this :

add_filter( 'wp_insert_post_data', 'rm_wp_insert_post_data', '99', 2 );
function rm_wp_insert_post_data ( $data , $postarr ) {
   return str_replace("\xc2\xa0", " ", $data); 
}

Does it apply to my problem ? (just for preventing, not for curing)

The only way i've found sofar is to manually edit the post, remove the space and recreate it with the space tab.

Source Link
Overdose
  • 385
  • 3
  • 14

Can't remove   generated by editor from database

I have found out that when i save post, there are "kind of" non breaking space saved, sometimes. I don't mind "regular  ". This can appear anywhere in the text.

In the editor, they are obviously not visible.

=> if i use the editor source tool, the space looks like regular space.

The problem is : on the site, they don't apprear so it's like the two words are without space at all.

If i check the source, i see   for these spaces.

I have already a lot of data saved, so i want to remove the nbspace with query :

I tried :

UPDATE `vss_posts` SET `post_content` = replace(`post_content`, " ", " ");

But it did nothing : the nbsp where still there.

i've seen this post talking about hexa nbsp;

But obviously,

UPDATE `vss_posts` SET `post_content` = replace(`post_content`, "\xc2\xa0", " ");

doesn't work.

What could be the problem ? How can i remove them in the db ? How can i prevent them to be saved again ?

In the aforementionned post i saw this :

add_filter( 'wp_insert_post_data', 'rm_wp_insert_post_data', '99', 2 );
function rm_wp_insert_post_data ( $data , $postarr ) {
   return str_replace("\xc2\xa0", " ", $data); 
}

Does it apply to my problem ? (just for preventing, not for curing)

The only way i've found sofar is to manually edit the post, remove the space and recreate it with the space tab.