I found a plugin that will fix another issue I have run into. This problem was caused by YouTube, not the WordPress Editor, aka Gutenberg.
This plugin also will automatically center your YouTube videos, so you won’t have to go to the WordPress Customizer and add the Additional CSS snippet I mentioned in my last post.
This plugin is the YouTube Embed and YouTube Gallery WordPress Plugin. So far it is working well. When you install it, just make sure that you go through the plugin’s Setup Wizard and select the options you need.
Note: The plugin has a premium version, but when I tested it today, I could accomplish what I needed without purchasing the upgrade. Although I am recommending this plugin, I am not receiving any commission for recommending it. All support questions need to be directed to The EmbedPlus Team.
I like the new editor in WordPress. During development, it was called Gutenberg. Some still call the editor by its development name, but as of November, 2018, the editor is part of the WordPress Core.
I like it, but I have had one problem with it. I couldn’t find a way to center an embedded video from YouTube, Vimeo, etc. Every time that I used an embed block, the video appeared justified to the left. I tried using the Center button. It didn’t work. I tried editing the block in HTML, adding the code to align to the Center. It didn’t work.
Well, today, I had had enough, so I went back to Google to see if anyone had found the solution. WinWar Media has the solution! Unfortunately, their instructions to make all videos appear centered didn’t work. So I tried the other code snippets and voila!
To implement their solution, go into the WordPress Theme Customizer (Appearance|Customize) and scroll down to Additional CSS. To center YouTube videos, just copy/paste the following code into that section of the Customizer:
margin: 0 auto;
To make Vimeo videos center, use this CSS Snippet:
margin: 0 auto;
Now…. if I can just find a way to not display the Related Videos at the end that are automatically supplied by Google. It used to be possible to do this by adding a little code to the end of the embed. But now that WordPress uses its own embed, I haven’t found a way yet.
I’ll post the fix when I find it!