Forums

where are the permalinks / slug stored in the database (8 posts)

  1. lerizzle
    Member
    Posted 2 years ago #

    where are the permalinks / slug stored in the database

  2. Bill Erickson
    Member
    Posted 2 years ago #

    I believe they are stored in the wp_posts table, guid is the field name.

  3. lerizzle
    Member
    Posted 2 years ago #

    thats what you would think but all the urls in there are

    url.com?page=4

    Where does it say this is actually

    url.com/aboutus/

  4. Bill Erickson
    Member
    Posted 2 years ago #

    Now that I think about it, they aren't stored in the database. When you load a page, it uses WordPress' rewrite rules to figure out what content you want. That's why when you change your rewrite rules it doesn't have to go through the database and update all the records.

    Here's some more info: http://codex.wordpress.org/Function_Reference/WP_Rewrite

  5. lerizzle
    Member
    Posted 2 years ago #

    Thank you so much.. I've been searching for this information forever.

  6. Erik
    Member
    Posted 2 years ago #

    The slug is stored in the wp_posts table in the column "post_name". This also stores all the auto-save and revision titles as well, but for your actual published posts and pages, this is the slug.

    Now, this isn't the entire permalink, this is just the character-stripped slug, so if you had a post or page called "This is my title", it would be stored here as "this-is-my-title".

    This is different than the "post_title" field, and the GUID field.

    Now, the permalink structure is built on the fly using the settings you set in the wordpress options. But the actual slug itself is stored here.

    Does this help at all?

  7. lerizzle
    Member
    Posted 2 years ago #

    awesome thanks!

  8. lerizzle
    Member
    Posted 2 years ago #

    Since you guys seem to know about permalinks here's my next question.

    I developed a plugin and I use URL query vars. How can I turn those in nice permalinks?

    I have http://www.URL.com/page/subpage/?id=1

    I want http://www.URL.com/page/subpage/id/1

    Any direction to the answer would be appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.