WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#13110 closed defect (bug) (fixed)

Look at new revision doesn't work on custom post type

Reported by: markoheijnen Owned by:
Milestone: 3.0 Priority: high
Severity: normal Version: 3.0
Component: Posts, Post Types Keywords: has-patch needs-testing
Focuses: Cc:

Description

When there is newer version of of an custom post type because of autosave, the link doesn't work.

I looked at wp-admin/revision.php and found out that the problem is the check at rule 130:

elseif ( !post_type_supports($post->post_type, 'revisions') )

Attachments (1)

13110.diff (4.9 KB) - added by duck_ 11 years ago.

Download all attachments as: .zip

Change History (12)

#1 @markoheijnen
11 years ago

  • Keywords need-fix added; need-patch removed

#2 @markoheijnen
11 years ago

  • Priority changed from normal to low

I didn't had revisions in my supports:
'supports' => array('title', 'editor', 'author', 'revisions')

So there need an change here.
Not autosave my post or no warning when there is one.

#3 @nacin
11 years ago

  • Keywords needs-patch added; need-fix removed

#4 @yoavf
11 years ago

  • Keywords dev-feedback added

I'm not sure what the outcome should be here -
I think we should 'autosave' even if revisions are disabled for that custom post type.

#5 @yoavf
11 years ago

  • Cc yoavf added

#6 @markoheijnen
11 years ago

I think if revision isn't used, autosave should work different. Now you got the same message if you would used it but the link is broken.

If it isn't used by the content type, the revision shouldn't be stored but I can see there should be a newer version when there is one.

Because if it should work the same the option better can removed. The way it works now is confusing.

#7 @nacin
11 years ago

  • Keywords dev-feedback removed
  • Priority changed from low to high

I don't see why 'revisions' should disable autosaving. We still enable autosaves when revisions are disabled, and it should be no different. (Relevant code there is ! WP_POST_REVISIONS && !wp_is_post_autosave( $revision ).

Needs patch. We need to allow revision display for autosaves even when ! post_type_supports('revisions').

@duck_
11 years ago

#8 @duck_
11 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

Patch allows viewing autosave revisions for post types which don't support revisions.

Also, removes a bit of dead code and small HTML validation issue.

#9 @nacin
11 years ago

Patch reads well. Thanks for sorting through all that logic.

#10 @ryan
11 years ago

Tested. Looks good.

#11 @automattor
11 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [14749]) Fix viewing autosave revision for custom post types. Props duck_. fixes #13110

Note: See TracTickets for help on using tickets.