Support » Fixing WordPress » How to limit the length of an URL (Post slug)?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Well, the problem with automatic is you may end up with ugly URLs.


    Post title – This is my post title and it’s really cool
    Auto-slug – This-is-my-pos


    I’d say just use the advanced editing form as your default and make your own slug for those long titled posts as you type them. Is it really that hard? 😉

    Hi Viper007Bond. Thank you very much for your answer.

    I don’t mind if the URLs are ugly.

    Anyway, I modified ‘functions-formatting.php’, and added this line
    at the end of ‘function sanitize_title’ (before returning $title):
    $title = substr($title, 0, 30);

    It works.

    Mmm… it doesn’t work 🙁

    If I include that line, then old permalinks don’t appear.

    Can anyone make a plugin that does this? Or include this option in the official wordpress code? I run a multi-user blog, and while I can usually remember to truncate my post slugs, other people don’t. I want to prevent the URLs from getting too long *automatically.*



    I’ve just created a plugin to do this. Take a look at the anouncement:
    and download the plugin at:


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to limit the length of an URL (Post slug)?’ is closed to new replies.