Bash script to apply Yoast SEO multilingual fix patch

Beach scene with rock formation at sunset.

We have previously created a patch to fix the part of Yoast SEO that is not multilingualized by Bogo. It’s a hassle to manually apply the patch every time an update is made, so I made it into a Bash script.

Page Language Swicher

Patch to make Yoast SEO output multilingual

We have previously reported that there are parts of the site where multilingualization by Bogo is not applied.

Of the four items, one was the WordPress itself and three were parts of Yoast SEO. The links above describe the patches to be applied to the three files.

Every time Yoast SEO updated, I had to manually patch the relevant files. I have done this twice so far, and it is a bit tedious.

Scripts for patching

I have created a bash script that patches the three files of the Yoast SEO plugin.

Bash
#!/bin/bash
cd ~/public_html/wp-content/plugins/wordpress-seo/inc
cp -p ./class-wpseo-replace-vars.php ./class-wpseo-replace-vars.php.original
patch -u ./class-wpseo-replace-vars.php < ~/yoast_seo_changed_file_backup/class-wpseo-replace-vars.php.diff
cd ~/public_html/wp-content/plugins/wordpress-seo/src/generators/schema
cp -p ./website.php ./website.php.original
patch -u ./website.php < ~/yoast_seo_changed_file_backup/website.php.diff
cd ~/public_html/wp-content/plugins/wordpress-seo/src/integrations/front-end
cp -p ./rss-footer-embed.php ./rss-footer-embed.php.original
patch -u ./rss-footer-embed.php < ~/yoast_seo_changed_file_backup/rss-footer-embed.php.diff
do_patch.sh
  • Go to the relevant directory
  • Contribute the original as a separate file
  • Patch the relevant files

This is an easy fix. I will use this in the next update of the Yoast SEO plugin.

PS : I used it after two updates after this and it worked fine.

Musubi

I did not do a noon update today due to lack of excitement. There are days like this.

Yesterday I published an article on the two-column layout of the Twenty Twenty Five theme. This weekend I plan to make a few posts about the customizations I have made on this blog.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *