Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#6083 closed defect (bug) (fixed)

Post url preview messed up.

Reported by: Nightgunner5 Owned by:
Milestone: 2.5 Priority: normal
Severity: normal Version: 2.5
Component: General Keywords:
Focuses: Cc:


==What happened?==

I was typing a test post to demo the new position of the autosave, when I noticed that the url of the post (as it autosaved) was not shown correctly according to my settings. (See attachment)

My permalink settings are /%category%/%post_id%/%postname%/, but it showed %post_id%/%post_id%/, even though I had typed in a title well before it autosaved. I did not choose a category.

wp trunk r7145
Windows XP Media

==What should be done?==
When a post autosaves for the first time, the default category should be ajax'd into the category selection meta box and the permalink preview. It should also figure out the post slug.

Attachments (3)

post_title_missing.png (6.6 KB) - added by Nightgunner5 12 years ago.
autosave-default-category.diff (610 bytes) - added by nbachiyski 12 years ago.
get-permalink-default-category.diff (708 bytes) - added by nbachiyski 12 years ago.

Download all attachments as: .zip

Change History (12)

#1 @nbachiyski
12 years ago

The missing title problem is due to the patch in #6072.

#2 @nbachiyski
12 years ago

In case of missing categories the default one is used, but it is set on the first real save. Here is a patch, which users the default category if on autosave there were none of them.

#3 @ryan
12 years ago

Having autosave assign the default category is rather annoying. Can we do this in the sample permalink code somehow?

#4 @nbachiyski
12 years ago

That was the first thing I tried -- get_permalink uses get_the_category, in which I couldn't find an easy way to add a filter.

Anyway, the category is set, but it doesn't check the default category checkbox, so I guess it is annoying in code point of view?

#5 @ryan
12 years ago

My concern is with the post getting the default category when the user hasn't asked for the default category. We usually don't set the default category until publish time and only then if no other categories have been checked. If the old behavior is preserved, then no worries.

Could get_permalink simply use the default category if get_the_category() returns nothing?

#6 @nbachiyski
12 years ago

Currently the category is set on save, not on publish. That's why this patch isn't breaking the current behaviour.

I have applied patch for get_permalink, I agree it is a better place for the change.

Also, I think it would be a good idea to push the default category only on publish and not on saving drafts. However it will need some more digging, because setting the default category is done at more than one place and I will have to see, which callers really expect it to be set.

#7 @nbachiyski
12 years ago

I meant attached, not applied, of course.

#8 @ryan
12 years ago

(In [7204]) Use default category when getting permalink if the post has no categories assigned. Props nbachiyski. see #6083

#9 @ryan
12 years ago

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.