How to configure and re-configure Yoast for WordPress

This post actually does not have much to do with financial programming unless you are using WordPress as one of your tools, as I do 😃.

I have a nice setup where I am developing locally using Docker and then I have Actions configured in GitHub where my pull requests trigger a deployment to an Azure Container App.

I am using JWT Authentication for WordPress to secure some of my routes and I am using a theme in WordPress that we have developed in-house.

Every time I want to install and active a new plugin I do that first locally and then I deploy the code into production which is the Container App.

This time I was going to add Yoast SEO so I did the same thing as usual and everything worked locally so I deployed the code and then were going to conduct the Yoast first time configuration in the production environment.

This is when I started to have problems!

When I opened my production website I had the following error message:

Warning: include(/var/www/html/wp-content/plugins/wordpress-seo/vendor/composer/../../vendor_prefixed/psr/log/Psr/Log/LoggerTrait.php): Failed to open stream: No such file or directory in /var/www/html/wp-content/plugins/jwt-authentication-for-wp-rest-api/includes/vendor/composer/ClassLoader.php….

I had to revert my commit and go back to the old state and tried to de-activate Yoast to try to install it again but fully from the production environment, this did not work though.

I found this article https://wordpress.org/support/topic/remove-all-data-for-yoast-seo-plugin-from-database/ which explained what I should remove from the database which I followed and then I could remove the plugin.

My idea was to install the plugin locally and not activate it, then deploy the code and do the activation in the production environment which should make the database changes. You see, everything had worked both locally and in production while the Yoast plugin was de-activated.

When I then tried to activate he plugin I instead got a bunch of errors that looked like this:

WordPress database error: [Table ‘wordpress.wp_yoast_indexable’ doesn’t exist]
SELECT * FROM wp_yoast_indexable WHERE object_id = ’44’ AND object_type = ‘post’ LIMIT 1

WordPress database error: [Table ‘wordpress.wp_yoast_indexable’ doesn’t exist]
SELECT * FROM wp_yoast_indexable WHERE object_id = ’44’ AND object_type = ‘post’ LIMIT 1

Looking in the database the Yoast tables were missing. I started to look deeper into the wp_options table where I had deleted all content with wpseo in it using the following query:

DELETE FROM wordpress.wp_options WHERE option_name LIKE “%wpseo%”;

I saw a few entries that had the name yoast in them, which was not mentioned by the wordpress.org article so I ran the following query too:

DELETE FROM wordpress.wp_options WHERE option_name LIKE “%yoast%”;

This removed the entry in the database that stored what database migration my system had for the Yoast tables and that was the last thing that was needed. Now when I activated the plugin again the tables were created.

Now the activation of Yoast worked but I did get an error message after activation saying:

Deprecated: strip_tags(): passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/wp-admin/admin-header.php on line 36

This was a non fatal error though and the site worked as it should from this point forward.

It took me some time to figure out what more to delete from the database table wp_options so I thought that I might be able to save a few hours of searching for other people that might end up in the same dead end 😊

One thought on “How to configure and re-configure Yoast for WordPress

  1. I found the root cause of my problems with Yoast 😊😊

    Yoast uses folders called both log and debug which are ignored by default in my gitignore file so I had to add these lines at the end of my gitignore file:

    # Include log directory for Yoast
    !/wordpress-html/wp-content/plugins/wordpress-seo/vendor_prefixed/psr/log
    !/wordpress-html/wp-content/plugins/wordpress-seo/vendor_prefixed/psr/log/Psr/log
    !/wordpress-html/wp-content/plugins/wordpress-seo/src/presenters/debug

    The reason it worked locally was of course since those files were in my local directory and then included in Docker. They were never included in the GitHub repo and not in my Azure Container App so this was the whole issue.

Leave a Reply

Discover more from Put the fun in finance

Subscribe now to keep reading and get access to the full archive.

Continue reading