On post edit pages, when a slug exceeds a certain number of characters, Wordpress abridges it with an ellipsis (...). For example, if my slug is i-want-to-be-able-to-see-this-slug, it appears on the edit page like this:

Permalink: http://example.com/2012/i-want-to-be-a...-see-this-slug/ [ Edit ]

Can I prevent Wordpress from doing this?

I like to be able to see (and copy) a full URL without obfuscation, so I'm dying to find out how to get rid with this feature.

  • only edit tags for better related – bueltge Jan 27 '12 at 20:05
up vote 4 down vote accepted

There is a filter at the end of the function: 'get_sample_permalink_html'. Hook into this and just replace the shortened form with the full length.

<?php # -*- coding: utf-8 -*-
/* Plugin Name: T5 Unabridge Permalink Slug */

add_filter( 'get_sample_permalink_html', 't5_unabridge_sample_permalink', 10, 2 );

 * Replaces the shortened permalink with its full form.
 * @param  string $sample Permalink HTML
 * @param  int    $id Post ID
 * @return string
function t5_unabridge_sample_permalink( $sample, $id )
    $link = get_sample_permalink( $id );
    $s1   = '<span id="editable-post-name" ';
    $s2   = '</span>';

    return preg_replace(
        '~' . $s1 . '([^>]*)>([^<]*)' . $s2 . '~Ui',
        $s1 . '$1>' . $link[1] . $s2,


Post title: This is a rather long post title. WordPress would shorten it by default, but our nice plugin prevents that.

enter image description here

Download from GitHub.

  • Hey toscho - I looked all over for the answer to this; it's nowhere else AFAICT! Thanks!!!! – MikeSchinkel Mar 15 '14 at 7:57

Its not possibel via filter or action hook, WordPress cut the strings hard in core. see wp-admin/includes/post.php line 1110 in WP 3.4alpha

if ( function_exists('mb_strlen') ) {
    if ( mb_strlen($post_name) > 30 ) {
        $post_name_abridged = mb_substr($post_name, 0, 14). '&hellip;' . mb_substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
} else {
    if ( strlen($post_name) > 30 ) {
        $post_name_abridged = substr($post_name, 0, 14). '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;

You can open a ticket on the Trac of WordPress for include an filter.

As @bueltge notes in his answer, there's currently no filter or action hook that would allow this. Here is the hack I did to prevent ... abbreviation.

In the file wp-admin/includes/post.php, find this line (in Wordpress 3.4.1, it is line 1117):

$post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';

Change it to this:

// Changed $post_name_abridged to $post_name to prevent "..." abridgement of long slugs
$post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name . '</span>';

Of course, because this edits a core file, the change will be overwritten whenever a new version of Wordpress updates this file.

If anyone can recommend a non-core-hacking way to achieve this, I'd certainly use that over this.

  • 1
    You should not edit core files. See @toscho's answer for a work around. – Stephen Harris Jul 4 '12 at 20:31

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.