WordPress

Permalink

Permalink is the permanent URL WordPress gives to a post, page, or archive. The structure comes from Settings > Permalinks and the content's slug.

How it is measured

The structure is stored in the permalink_structure option, for example /%postname%/ or /%year%/%monthnum%/%postname%/. The default plain form is ?p=123. The slug is the post_name column in wp_posts. In code, get_permalink( $post_id ) returns the full URL.

Check what the site uses with wp option get permalink_structure. If the value is empty, the site uses plain permalinks and does not need rewrite rules at all.

Worked example

A local news blog has 1,900 posts at /2019/06/city-budget-vote/. The new editor switches to /%postname%/ for cleaner URLs. Every old link from other sites and from Google now returns 404, and organic traffic falls 38 percent in two weeks.

The fix is a redirect plugin or server rule that maps the date-based pattern to the new one. The editor reverts the structure first, which restores the old URLs immediately.

How it differs

A permalink is the address, while rewrite rules are the mechanism that makes the address resolve to a WordPress query. You can change the permalink structure without editing any file, but the rules must be regenerated. On Apache, the .htaccess file passes requests to WordPress and the rules take over.

Common errors

Changing the structure on a live site without redirects. Using %category% in the structure and then moving posts between categories. Leaving the default plain form on a new site. Forgetting to save Settings > Permalinks after registering a custom post type. Putting numbers only in a slug and clashing with a page ID.

In practice

Set the permalink structure before you publish anything, and use /%postname%/ unless there is a reason not to. If you must change an existing site, export the old URLs, create redirects, and test a sample of 20 on staging.

See also

Rewrite rules, .htaccess

Sources

Count this on a real site.

Watch my website