[wp-trac] Re: [WordPress Trac] #6529: Cannot edit page-slug before
publishing
WordPress Trac
wp-trac at lists.automattic.com
Thu May 1 01:36:50 GMT 2008
#6529: Cannot edit page-slug before publishing
---------------------------------+------------------------------------------
Reporter: tibc | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.5.2
Component: Administration | Version: 2.5
Severity: major | Resolution:
Keywords: page slug permalink |
---------------------------------+------------------------------------------
Comment (by dstebila):
I have this problem as well on WP 2.5.1 on PHP 4.4.1.
Although I am not very familiar with the WP internals, I have come up with
two possible workarounds. These work for me, but '''could damage your
system''' so be careful. I believe Approach 1 is safer because it only
changes the presentation on the Javascript level, whereas Approach 2
messes with the internals of a PHP function.
__Approach 1:__ Re-enable the slug field for pages. In the file wp-
admin/js/page.js, change the line
{{{
jQuery('#pageslugdiv').hide();
}}}
to
{{{
// jQuery('#pageslugdiv').hide();
}}}
__Approach 2:__ Try to fix the permalink box for draft pages. In the
file wp-admin/includes/post.php, change the following lines
{{{
$uri = get_page_uri($post->ID);
$uri = untrailingslashit($uri);
$uri = strrev( stristr( strrev( $uri ), '/' ) );
$uri = untrailingslashit($uri);
if ( !empty($uri) )
$uri .='/';
$permalink = str_replace('%pagename%', "${uri}%pagename%",
$permalink);
}}}
to
{{{
if (in_array($original_status, array('draft', 'pending')))
{
$permalink = '%pagename%';
} else {
$uri = get_page_uri($post->ID);
$uri = untrailingslashit($uri);
$uri = strrev( stristr( strrev( $uri ), '/' ) );
$uri = untrailingslashit($uri);
if ( !empty($uri) )
$uri .='/';
$permalink = str_replace('%pagename%',
"${uri}%pagename%", $permalink);
}
}}}
--
Ticket URL: <http://trac.wordpress.org/ticket/6529#comment:12>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list