WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#6529 closed defect (bug) (worksforme)

Cannot edit page-slug before publishing

Reported by: tibc Owned by: azaozz
Milestone: Priority: normal
Severity: major Version: 2.7
Component: JavaScript Keywords: needs-patch
Focuses: Cc:

Description

Only after publishing a new PAGE will the permalink display and become editable.

First reported as a RC bug in ticket #6416, the issue was quickly dismissed as invalid because it could not be duplicated.

I confirm that this is a problem in 2.5 final. I have seen this on different pc's, using different browsers (IE7, FF, and Safari), in different installs of WP2.5 (including one absolutely clean and new installation), on different hosts (including one WAMP server).

The problem exists only with a new PAGE. The new POST function works as designed.

Skeptics should see the attached screen capture.

Attachments (2)

page-slug-missing.jpg (59.4 KB) - added by tibc 6 years ago.
screen capture of missing page slug/permalink
patch.diff (1.0 KB) - added by MattyRob 6 years ago.

Download all attachments as: .zip

Change History (22)

tibc6 years ago

screen capture of missing page slug/permalink

comment:1 fitztrev6 years ago

Confirmed.

comment:4 Nazgul6 years ago

  • Milestone set to 2.6

comment:5 in reply to: ↑ description sfeather6 years ago

Experiencing the same problem here.
I can create a screencast to prove it, since there seems to be an air of "works fine for me so isn't a problem".

What information do the devs need to help to actually pinpoint why this occurs on some systems and not on others?

comment:6 fitztrev6 years ago

It seems like the same process is applied on post-new.php and it works without a problem there. However, on page-new.php, that's where the issue is.

It appears the AJAX POST request to admin-ajax.php isn't coming back with a response. When the request, with action 'sample-permalink', is sent, nothing is received. Firebug just says "Loading..." when inspecting the current javascript processes.

comment:7 link2caro6 years ago

  • Milestone changed from 2.6 to 2.5.1

I did make a ticket for this issue, and just found this ticket, I just want to add an information:

I have WordPress 2.5 work on 3 servers, two work well with the Page slug (dedicated servers) and another is a hosting from 1and1 where the Page slug does not work.

comment:8 tai6 years ago

Reproduced with PHP 4.3.3, but not with 5.2.3. It may be specific to the PHP version.

comment:9 link2caro6 years ago

Issue produced with 4.4.8
Non with 5.2.5

Requirement for WP2.5 perhaps should be PHP 5, j/k

comment:10 GamerZ6 years ago

seconded link2caro, problem does not appear to be in PHP 5.2.5

comment:11 chrismou6 years ago

I'm running WP 2.5 on the Media Temple grid server, PHP 5.2.5.

I came across this ticket because I was having this exact problem with a page I built last week - couldn't get the edit slug link to appear until after I'd published.

BUT Ive just tried to recreate it and suddenly.. its working fine. I have no clue what I did differently, but Ive made no changes to any of the files on my server since before I noticed the problem. I don't think Ive deactivated any plugins in the meantime, but I'll look into that a bit further when I get a chance...

comment:12 dstebila6 years ago

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);
		}

comment:13 MattyRob6 years ago

Having compared the post.js file with the page.js file the jQuery commands are specified in a different order. I cannot reproduce this issue but have attached a patch the alters the command order in page.js to match the order in post.js

This might be worth applying and testing.

MattyRob6 years ago

comment:14 ryan6 years ago

  • Milestone changed from 2.5.2 to 2.9

Milestone 2.5.2 deleted

comment:15 mrmist6 years ago

Also a bug (with 2.6) on PHP 4.3.9 but not seen on 5.2.5.

I applied the patch diff (to the broken one) but it had no effect.

comment:16 mrmist5 years ago

  • Keywords needs-patch added
  • Milestone changed from 2.9 to 2.8
  • Version changed from 2.5 to 2.7

Bizarely, this is still an issue in 2.7

comment:17 follow-up: lelion5 years ago

Just to add that I can see this bug in WordPress 2.7.1, clean install, Default theme.

PHP Version 5.2.6, MySQL 5, Apache 2.0.

Hosting is DreamHost.

comment:18 in reply to: ↑ 17 ; follow-up: zeronex5 years ago

Replying to lelion:

Just to add that I can see this bug in WordPress 2.7.1, clean install, Default theme.

PHP Version 5.2.6, MySQL 5, Apache 2.0.

Hosting is DreamHost.

This has been fixed for 2.7
Click new page, now select "Screen Options" from top right just below Howdy, admin. This is where you can select to slug.

Hope this helps.

Thanks

comment:19 in reply to: ↑ 18 Denis-de-Bernardy5 years ago

  • Component changed from Administration to JavaScript
  • Keywords page slug permalink removed
  • Owner changed from anonymous to azaozz

Replying to zeronex:

This has been fixed for 2.7
Click new page, now select "Screen Options" from top right just below Howdy, admin. This is where you can select to slug.

no no, it's a genuine issue. it's supposed to display the permalink under the title (as is done with the post)

comment:20 Denis-de-Bernardy5 years ago

  • Milestone 2.8 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

seems fixed in trunk.

Note: See TracTickets for help on using tickets.