WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 21 months ago

#24116 closed task (blessed) (invalid)

Set post format when arriving to post-new.php?format={post_format}

Reported by: markjaquith Owned by: markjaquith
Milestone: Priority: normal
Severity: normal Version: 3.6
Component: Post Formats Keywords: has-patch commit
Focuses: Cc:

Description

So that we (or others) can jump-start people into a specific post format, we should respect format in a query arg for post-new.php.

Attachments (4)

24116.diff (541 bytes) - added by wonderboymusic 2 years ago.
24116.2.diff (690 bytes) - added by wonderboymusic 2 years ago.
24116.3.diff (529 bytes) - added by kovshenin 2 years ago.
24116.4.diff (1.5 KB) - added by kovshenin 2 years ago.

Download all attachments as: .zip

Change History (17)

@wonderboymusic2 years ago

comment:1 @wonderboymusic2 years ago

  • Keywords has-patch added

@wonderboymusic2 years ago

@kovshenin2 years ago

comment:2 @kovshenin2 years ago

I always found it irritating when I put something in the query string, and then WordPress unsets it somewhere along the way, so it never reaches my plugin. We don't do that in get_default_post_to_edit and I don't think we should do it for post formats either.

Also, format sounds too generic, I think we should use post_format, like we do with post_type.

24116.3.diff addresses the above.

comment:3 @SergeyBiryukov2 years ago

  • Keywords commit added

24116.3.diff looks good to me.

comment:4 follow-up: @nacin2 years ago

I agree with not unsetting items from superglobals. Sometimes we do it to avoid clashes with the WP class, though.

I'd prefer 'format' over 'post_format'. 'post_format' (and, yes, 'post_type') are crufty. Why not go simple when we have the chance?

This must also only apply (I can't tell looking at just the patch) when the post type supports post formats.

comment:5 in reply to: ↑ 4 ; follow-up: @kovshenin2 years ago

I don't think it matters all that much in the URL, but we already use post_format as a query var in edit.php and on the front end, and the taxonomy is also called post_format. Not sure it's really worth stepping away from the convention, for the little benefit that it would bring to this single URL.

This must also only apply when the post type supports post formats.

It does.

comment:6 in reply to: ↑ 5 @nacin2 years ago

Replying to kovshenin:

I don't think it matters all that much in the URL, but we already use post_format as a query var in edit.php and on the front end, and the taxonomy is also called post_format. Not sure it's really worth stepping away from the convention, for the little benefit that it would bring to this single URL.

This isn't a query variable we link to; this is a shortcut for jumpstarting a post. The precedent is ?content=&excerpt= (though, oddly, post_title).

comment:7 @nacin2 years ago

Should this also only work on post-new.php? Seems like it should be inside the auto-draft branch below it.

comment:8 @nacin2 years ago

And what should happen to $post_format_set_class if ?format is provided? So maybe that's an else.

@kovshenin2 years ago

comment:9 @kovshenin2 years ago

In 24116.4.diff:

  • Back to using ?format vs ?post_format
  • Correct handling of $post_format_set_class
  • Set correct screen icon with ?format

comment:10 @markjaquith2 years ago

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

In 24081:

post-new.php?format=X will pre-fill the format, to allow for Post-Format-chosen-first editor jump-starting.

props kovshenin, wonderboymusic. fixes #24116.

comment:11 @nacin21 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:12 @nacin21 months ago

In 24692:

Revert ?format= on post.php. see #24116.

comment:13 @nacin21 months ago

  • Milestone 3.6 deleted
  • Resolution set to invalid
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.