PHPackages                             mantekio/arabic-slug-schema-guard - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. mantekio/arabic-slug-schema-guard

ActiveWordpress-muplugin[Localization &amp; i18n](/categories/localization)

mantekio/arabic-slug-schema-guard
=================================

WordPress must-use plugin that stops core updates from truncating long Arabic URLs (the VARCHAR(200) slug-column trap).

v1.0.0(yesterday)00GPL-2.0-or-laterPHP

Since Jun 18Pushed todayCompare

[ Source](https://github.com/mantekio/arabic-slug-schema-guard)[ Packagist](https://packagist.org/packages/mantekio/arabic-slug-schema-guard)[ Docs](https://github.com/mantekio/arabic-slug-schema-guard)[ RSS](/packages/mantekio-arabic-slug-schema-guard/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (1)Versions (2)Used By (0)

Arabic Slug Schema Guard
========================

[](#arabic-slug-schema-guard)

[![Packagist Version](https://camo.githubusercontent.com/5f2a56d8a63e71f7418299edcb0d5eb96464e6cc7851adf35696391c293b8484/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d616e74656b696f2f6172616269632d736c75672d736368656d612d6775617264)](https://packagist.org/packages/mantekio/arabic-slug-schema-guard) [![License: GPL v2](https://camo.githubusercontent.com/34fd4798bfe47593a94283d1d4fb5c522738d07b84c13f374f10485c0e0ffbbf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d47504c76322d626c75652e737667)](LICENSE)

A WordPress **must-use plugin** that stops core updates from silently truncating long Arabic (and other non-Latin) URLs.

> 📖 **Full write-up:** [The 200-byte trap: why WordPress core updates break Arabic URLs](https://www.mantek.io/insights/wordpress-arabic-slug-truncation)

The problem
-----------

[](#the-problem)

WordPress stores post and term slugs **percent-encoded** in `VARCHAR(200)` columns (`wp_posts.post_name`, `wp_terms.slug`). Each Arabic character costs about **six bytes** once URL-encoded, so a `VARCHAR(200)` column holds only ~33 Arabic characters — and Arabic publishers widen the columns to `VARCHAR(1024)`.

The trap: on every major core update, `dbDelta()` reconciles the live schema against WordPress's canonical schema and **shrinks `VARCHAR(1024)` back to `VARCHAR(200)`**. Unlike `TEXT`/`BLOB`, `VARCHAR` has no downsize protection, so the truncation is silent and **unrecoverable** — and your long-headline URLs start returning 404.

Widening the column alone isn't enough, either: WordPress hard-codes `200` in **three** independent places — storage, slug **generation** (`sanitize_title_with_dashes()`), and collision **de-duplication** (`_truncate_post_slug()`).

What it does
------------

[](#what-it-does)

- **Prevents the shrink** (Layer 1) — filters `dbdelta_create_queries` so dbDelta's *desired* schema already says `1024`; it never emits a destructive `CHANGE COLUMN`. Covers the admin DB-upgrade screen, background auto-updates, and `wp core update-db`.
- **Stops new slugs truncating** (Layer 2) — replaces `sanitize_title_with_dashes()` with a byte-for-byte copy that raises the generation cap.
- **Verifies + alerts** (tripwire) — after every core update it checks the real column widths, logs and (optionally) emails on a revert, and exposes a `wp asg verify` CLI command for cron.

Layer 3 (collision de-dup) only fires on slug clashes and is left optional — see the write-up.

Installation
------------

[](#installation)

This is a must-use plugin, so it loads before the upgrade routine runs and can't be deactivated by accident.

**Manual**

```
mkdir -p wp-content/mu-plugins
cp arabic-slug-schema-guard.php wp-content/mu-plugins/
```

**Composer**

```
composer require mantekio/arabic-slug-schema-guard
```

### One-time: widen the columns

[](#one-time-widen-the-columns)

The plugin *keeps* the columns wide; you still widen them once. On a small site:

```
ALTER TABLE wp_posts MODIFY post_name VARCHAR(1024) NOT NULL DEFAULT '';
ALTER TABLE wp_terms MODIFY slug      VARCHAR(1024) NOT NULL DEFAULT '';
```

On a large `wp_posts` (millions of rows) the `200 → 1024` change crosses InnoDB's VARCHAR length-byte boundary and forces a full table rebuild — use an online schema-change tool instead of a raw `ALTER`:

```
pt-online-schema-change \
  --alter "MODIFY post_name VARCHAR(1024) NOT NULL DEFAULT ''" \
  --execute D=wordpress,t=wp_posts
```

Configuration
-------------

[](#configuration)

Define before the plugin loads (e.g. in `wp-config.php`), or edit the constants at the top of the file:

ConstantDefaultMeaning`ASG_COLUMN_LEN``1024`Physical column width (bytes)`ASG_SLUG_BYTES``1000`Max generated slug length — under the column, leaving room for a `-2` collision suffix`ASG_ALERT_EMAIL`*(unset)*If defined, the tripwire emails this address when a column revertsVerifying
---------

[](#verifying)

```
wp asg verify
```

Nightly cron — alert if either column ever reverts:

```
0 3 * * *  cd /var/www/site && wp asg verify | grep -q REVERTED \
           && wp asg verify | mail -s "WP slug schema reverted on $(hostname)" ops@example.com
```

Important caveats
-----------------

[](#important-caveats)

- The tripwire restores the **column definition**, never bytes already truncated. Treat any revert as an incident: restore from backup and check your 404 logs.
- **Never import a SQL dump taken *before* you widened the columns** — the old `CREATE TABLE` puts you back at 200. A dump of the *current* database is fine.

How it works (and why `VARCHAR(1024)` is safe)
----------------------------------------------

[](#how-it-works-and-why-varchar1024-is-safe)

The full root-cause analysis — the `dbDelta` chain, why the fixed **191-character index prefix** means widening the column carries no index / InnoDB / utf8mb4 risk, and the production rollout for multi-million-row sites — is in the write-up:

**→ [The 200-byte trap: why WordPress core updates break Arabic URLs](https://www.mantek.io/insights/wordpress-arabic-slug-truncation)**

License
-------

[](#license)

[GPL-2.0-or-later](LICENSE) — same as WordPress.

---

Built and maintained by **[ManTek Technologies](https://www.mantek.io)** — WordPress + AWS at scale, for Arabic newsrooms and beyond.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/216154993?v=4)[ManTek Technologies](/maintainers/mantekio)[@mantekio](https://github.com/mantekio)

---

Top Contributors

[![jaafarabazid](https://avatars.githubusercontent.com/u/11146126?v=4)](https://github.com/jaafarabazid "jaafarabazid (2 commits)")

---

Tags

slugwordpressi18npermalinkarabicrtlmuplugindbdelta

### Embed Badge

![Health badge](/badges/mantekio-arabic-slug-schema-guard/health.svg)

```
[![Health](https://phpackages.com/badges/mantekio-arabic-slug-schema-guard/health.svg)](https://phpackages.com/packages/mantekio-arabic-slug-schema-guard)
```

###  Alternatives

[qtranslate/qtranslate-xt

qTranslate-XT (eXTended): Adds user-friendly multilingual content support, stored in single post.

60136.0k](/packages/qtranslate-qtranslate-xt)[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.3k10](/packages/helsingborg-stad-municipio)[bueltge/multisite-global-media

Multisite Global Media is a WordPress plugin which shares media across the Multisite network.

23131.8k](/packages/bueltge-multisite-global-media)[mediawiki/translate

The only standard solution to translate any kind of text with an avant-garde web interface within MediaWiki, including your documentation and software

438.0k](/packages/mediawiki-translate)[wcm/wcm-lang-switch

Adds a button to the admin toolbar. This buttons allows users to seamlessly switch between available languages..

202.0k](/packages/wcm-wcm-lang-switch)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
