WordPress.org

Support

Support » Plugins and Hacks » Custom page slug / modify default page slug?

Custom page slug / modify default page slug?

  • I’m looking for a plugin which allows me to modify the default behavior of the page slugs.

    For instance, by default a page with “My Page Title” gets a page slug of “my-page-title”. I need the *default* page slug to be “my_page_title” instead.

    Is there a plugin or way I can make this happen? Is it possible for me to write my own plugin, hooking into the slug-generation routine and making that happen?

Viewing 1 replies (of 1 total)
  • I guess you’re talking about permalinks?

    If so, you can write a plugin that filters wp_insert_post_data . The field you need to modify is called post_name .

    I made a codex page for that filter hook:
    http://codex.wordpress.org/Plugin_API/Filter_Reference/wp_insert_post_data – the information’s taken from the comments in wp-includes/post.php and i haven’t actually tried using it, so you may need to experiment a bit to get it to work.

    By the way, i believe it’s not considered to be good practice to use underscores in URLs, although i can’t remember why now!

Viewing 1 replies (of 1 total)
  • The topic ‘Custom page slug / modify default page slug?’ is closed to new replies.
Skip to toolbar