Automated SEO Meta Tags for 587 Articles in 4SEO
Summary
After migrating a blog, I needed to set meta title and meta description for each of the 587 articles in the 4SEO plugin. Manually, this would mean opening the Quick Edit 587 times and typing the text. I figured out the plugin's table format, reverse-engineered its hash function, and wrote a script that sets the meta tags exactly as if they were manually saved.
Technology Stack
| Technology | Role |
|---|---|
| Python | Reconnaissance and meta tag scripts |
| MySQL | 4SEO tables |
| 4SEO (Joomla) | SEO plugin that stores meta title and description |
| DeepSeek API | Generation of translated meta tags during the migration |
Context and Task
This is a continuation of the case study on blog migration: 587 articles were moved from a Russian site to an English one, and each already had translated meta title and meta description generated by DeepSeek during the translation phase. The task was to record these texts in the 4SEO plugin.
The challenge was that 4SEO stores the meta tags not in the article itself but in its own separate database table. Writing to a foreign database without understanding the schema is risky and could lead to ignored or overwritten records during the next scan.
Step 1. Schema Reconnaissance
First, I needed to understand where and how the data is stored. The script 05_inspect_4seo_schema.py exported the structure and showed that the key table is r510h_forseo_custom_meta.
Each record is linked to an article through a field of the form:
id=1986&option=com_content&view=article
The number is the ID of the article in Joomla, which is returned by the API upon publication.
Inside the record is a nested JSON with three meaningful parts:
custom— what is manually entered (manual meta tags);auto— what the plugin collects itself during a site crawl;hash_title/hash_description— checksums that the plugin uses to determine if the content has changed since the last crawl. These are MD5 hashes.
Writing to such a table without knowing the hashing algorithm is risky.
Step 2. Check Built-in Capabilities
Before diving into the database, I checked what the plugin itself can do. In the configuration, I found the setting metaAutoDescIfMissing, meaning that 4SEO can take the standard metadesc field of the article as an auto-description. This field was already filled with translated text upon publication.
The check showed that the auto-option does not solve the task. I needed specific meta title and meta description marked as manual — not what the plugin generated itself. I moved on to the direct approach.
Step 3. Real Sample Instead of Guesswork
To write correctly, I needed a real example of the line that 4SEO creates itself. I manually set the meta tags for one test article through Quick Edit and saved it. The result was an exemplary line: visible how custom, status_title, status_description, and hashes are filled.
Reverse Engineering the Hash Function
The most delicate part is the checksums. Hypothesis: the hash is an MD5 of json_encode(object, compact, with unicode escaping as \uXXXX). Exactly what PHP does inside Joomla.
The hypothesis needs to be tested on real data, so the formula was tested on two independent examples — on a test article and on the
