You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A meta tag is inserted when copy pasting a link #33585
I have also seen this exact issue inside one of my client sites. Due to this, the W3C markup validation is failing and not sure if this is causing any other issues or not.
I just have 2 questions:
When do you think it would be fixed? This seems a critical issue with the copy-pasting mechanism.
When it gets fixed, what will happen to the existing content? How will the <meta charset="utf-8"> be removed from the content? Will there be a tool to automatically do it or something? Cause it is not humanly possible to figure out all the places it is getting added and then manually removing them.
I have also seen this exact issue inside one of my client sites. Due to this, the W3C markup validation is failing and not sure if this is causing any other issues or not.
I just have 2 questions:
When do you think it would be fixed? This seems a critical issue with the copy-pasting mechanism.
When it gets fixed, what will happen to the existing content? How will the <meta charset="utf-8"> be removed from the content? Will there be a tool to automatically do it or something? Cause it is not humanly possible to figure out all the places it is getting added and then manually removing them.
Here is a roughly way to solve your question 2 before official solution release: Add code below into your current theme's functions.php
if ( ! function_exists( 'roughly_fix_issue_33585' ) ){
function roughly_fix_issue_33585( $content ){
return preg_replace('#</?meta(\s[^>]*)?>#i', '', $content);
}
}
add_filter( 'the_content', 'roughly_fix_issue_33585');
Hi @gVee,
Thanks for your reply. But With your snippet it is not changing the content in the DB so, this snippet needs to be there in the functions.php forever even after Gutenberg fix this issue. Right?
Hi @isaumya ,
Yes, it's mush safer doing a temporary dealing with your DB. So the snippet needs to be there until Gutenberg fix this issue. In my opinion, the Gutenberg dev team will remove the ugly meta tag from user's DB. I hope!!
Hi @gVee,
I also have the same hope and that what I asked the team about. Cause currently reading the comment on this thread seems like the Gutenberg team will make sure that this ugly meta tag does not gets added to the content after the fix is rolled out. But it will not fix the old content that already have the ugly meta tags in them.
Which is why I commented above that it makes no sense. As if they do that it will mean that we will have to keep the above snippet of code in the functions.php even after the issue has been fixed in Gutenberg as the fix will not fix the old content.
That's the matter I was trying to get more clarification about what is the plan of the Gutenberg team? Will the fix also fix the old contents to ensure we don't have to use the above snippet or not?
Hi @isaumya ,
hmmm, you can do further for clearing ugly meta tag when you saving post ,as below:
(But I am not sure whether it conflict with 3rd plugin or your favorite theme or not)
if ( ! function_exists( 'roughly_fix_issue_33585' ) ){
function roughly_fix_issue_33585( $content ){
return preg_replace('#</?meta(\s[^>]*)?>#i', '', $content);
}
}
add_filter( 'the_content', 'roughly_fix_issue_33585');
Hi @gVee,
Well, that snippet is risky to run on a client site. 😋
That being said, the first snippet is really handy but again I hope that when Gutenberg team releases a fix for this, they also run some sort of job to make sure this issue is also fixed in older articles. Maybe like some sort of upgreader process or something.
A suggestion for this issue is adding similar code to remove them(<meta charset="utf-8">) with javascript in use-paste-handler.js, as codes you made in the bottom of this file(use-paste-handler.js):
Activity
aercolino commentedon Sep 26, 2021
The same meta tag is also inserted when copy-pasting text between paragraphs. (WordPress 5.8.1 on Mac/Chrome)
isaumya commentedon Sep 29, 2021
I have also seen this exact issue inside one of my client sites. Due to this, the W3C markup validation is failing and not sure if this is causing any other issues or not.
I just have 2 questions:
<meta charset="utf-8">be removed from the content? Will there be a tool to automatically do it or something? Cause it is not humanly possible to figure out all the places it is getting added and then manually removing them.gVee commentedon Oct 27, 2021
I agree that is a critical issue not only for W3C markup validation but also a big interference on CSS styling.
gVee commentedon Oct 27, 2021
Here is a roughly way to solve your question 2 before official solution release: Add code below into your current theme's functions.php
isaumya commentedon Oct 27, 2021
Hi @gVee,
Thanks for your reply. But With your snippet it is not changing the content in the DB so, this snippet needs to be there in the
functions.phpforever even after Gutenberg fix this issue. Right?gVee commentedon Oct 27, 2021
Hi @isaumya ,
Yes, it's mush safer doing a temporary dealing with your DB. So the snippet needs to be there until Gutenberg fix this issue. In my opinion, the Gutenberg dev team will remove the ugly meta tag from user's DB. I hope!!
isaumya commentedon Oct 27, 2021
Hi @gVee,
I also have the same hope and that what I asked the team about. Cause currently reading the comment on this thread seems like the Gutenberg team will make sure that this ugly meta tag does not gets added to the content after the fix is rolled out. But it will not fix the old content that already have the ugly meta tags in them.
Which is why I commented above that it makes no sense. As if they do that it will mean that we will have to keep the above snippet of code in the
functions.phpeven after the issue has been fixed in Gutenberg as the fix will not fix the old content.That's the matter I was trying to get more clarification about what is the plan of the Gutenberg team? Will the fix also fix the old contents to ensure we don't have to use the above snippet or not?
gVee commentedon Oct 27, 2021
Hi @isaumya ,
hmmm, you can do further for clearing ugly meta tag when you saving post ,as below:
(But I am not sure whether it conflict with 3rd plugin or your favorite theme or not)
IF YOU really NEED a Plugin(which can uninstall when official fixes release)handling all of it in one go, just let me know...
isaumya commentedon Oct 27, 2021
Hi @gVee,
Well, that snippet is risky to run on a client site. 😋
That being said, the first snippet is really handy but again I hope that when Gutenberg team releases a fix for this, they also run some sort of job to make sure this issue is also fixed in older articles. Maybe like some sort of upgreader process or something.
So, for now I think I will just stick with:
Until this matter is properly resolved.
gVee commentedon Oct 28, 2021
So Sad, I found it seems Chrome problem not Gutenberg because the same issue occur on any web page with Chrome.
I've raise an bug issue to chromium bugs
@ellatrix @getdave
A suggestion for this issue is adding similar code to remove them(
<meta charset="utf-8">) with javascript in use-paste-handler.js, as codes you made in the bottom of this file(use-paste-handler.js):and call it near around line 91

getdave commentedon Nov 5, 2021
Thanks @gVee. Looks like something we should handle in Gutenberg as you suggest.
gVee commentedon Nov 6, 2021
@getdave
Thanks for understanding.
After reporting to Chromium, I got a response below:
https://bugs.chromium.org/p/chromium/issues/detail?id=1264616#c4
That is intentional for MacOS TextEdit , so ....