I see that I can edit permalink information in wp-admin page > settings > permalinks. However, where is that information actually stored in the database?
Leave a Reply
You must be logged in to post a comment.
I see that I can edit permalink information in wp-admin page > settings > permalinks. However, where is that information actually stored in the database?
You must be logged in to post a comment.
In the
wp_options
table there is a record whereoption_name = "permalink_structure"
.However, the true, ultimate control of url rewriting is controlled by the WP_Rewrite API which saves/caches its information in the
rewrite_rules
wordpress option (also found in thewp_options
table).EDIT:
Also, when editing a page/post, you can change the “permalink” for that page/post (right below where you change the title). All that is doing is merely setting the
post_name
field for that page’s/post’s entry inwp_posts
table (aka it’s changing the “slug” for that page).For all pages, it seems that the default rewrite rules are the following:
That list was obtained by me running this php code:
echo nl2br('rules = '.print_r( $wp_rewrite->rules, true) . "n");
There does not seem to be any builtin way to edit routing for pages since the permalink structure only applies to posts.
EDIT:
More random information I’m discovering: if your permalink_structure is an empty string (which is the “default” option you can choose), then wordpress completely skips all rewriting — I’m really not sure why that’s the case, but it is.
The actual information – e.g. the ‘slug’ for the page or post is stored in wp_posts under the post_name column. This is a slugified version of post_title normally, but can be overwritten on a page by page basis.
The full permalink is deconstructed based on what settings you have chosen in Settings -> Permalinks, but the actual slug is in post_name in wp_posts.
Permalink information is stored in wp_options.
Table name :- $wpdb->prefix’options’
And search option name like ‘permalink_structure’ in option table.
In that row in a table u can view the permalink structure.