WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 6 weeks ago

#20335 new enhancement

Make Default Post Listing Mode Filterable

Reported by: ericmann Owned by:
Milestone: Awaiting Review Priority: normal
Severity: trivial Version: 3.3.1
Component: Posts, Post Types Keywords: has-patch
Focuses: administration Cc:

Description

Inspired by a question on the WordPress Answers Stack Exchange.

By default, WordPress displays the post list in the admin as a list view. There's an option to switch to an excerpt view that many people use and some would like to set this as the default mode.

Unfortunately, the default is hard-coded into WordPress and is not filterable. I propose we add a basic filter to allow developers to override the default "list" setting for the view mode.

Attachments (4)

20335.diff (616 bytes) - added by ericmann 2 years ago.
Filter the default mode for the posts list table.
20335-2.diff (801 bytes) - added by ericmann 2 years ago.
Check/set a user option.
20335-3.patch (732 bytes) - added by azaozz 2 years ago.
20335.4.diff (748 bytes) - added by ericmann 6 weeks ago.
Refreshed patch

Download all attachments as: .zip

Change History (14)

ericmann2 years ago

Filter the default mode for the posts list table.

comment:1 follow-up: jane2 years ago

This is really a personal preference, just like rearranging dashboard widgets, using Visual editor or HTML tab, or hiding columns in list view, which is why it should remember the user's choice (so they only ever hit excerpt once). Is there a reason make this more of a developer choice instead of a user choice? At that point, would think the request would be for filters on everything that is currently a user view choice?

comment:2 in reply to: ↑ 1 ericmann2 years ago

Replying to jane:

It should remember the user's choice (so they only ever hit excerpt once).

I'm in agreement with you on this point.

Is there a reason make this more of a developer choice instead of a user choice? At that point, would think the request would be for filters on everything that is currently a user view choice?

In context, I was approaching this from the perspective of a developer setting up the initial environment for a client. But from a user perspective I think having persistent, user-based defaults would be a better approach. I'll revisit this after I have some time to think about a cleaner implementation than just calling get_user_meta() on everything.

comment:3 nacin2 years ago

This is really a personal preference, just like rearranging dashboard widgets, using Visual editor or HTML tab, or hiding columns in list view, which is why it should remember the user's choice (so they only ever hit excerpt once).

Yeah, what's weird with the list/excerpt choice is that it doesn't remember the user's choice. It certainly should. Turning in into a proper user option is all developers will need to be able to hook in and do what they wish. Though, there should probably be some hooks available as well, because some post type screens may wish to force one or the other just based on how that post type may be stored.

comment:4 ericmann2 years ago

OK, I'm sold on making this a user option. New patch checks for a user option if "mode" isn't passed in as a query arg. If it is, the user option is updated.

Devs can still filter on the user option if they want, but it's not required.

ericmann2 years ago

Check/set a user option.

comment:5 mbijon2 years ago

  • Cc mike@… added

+1 on this user option patch

Agree with @nacin that hooks are needed too, but this seems like it could be added cleanly now. Could hooks could be planned & added in a different ticket?

comment:6 DrewAPicture2 years ago

  • Cc xoodrew@… added

azaozz2 years ago

comment:7 azaozz2 years ago

Perhaps better to use the "user_settings" API for this, that's the "proper" place for storing these settings and it would make that available/changeable from JS if we ever need it.

20335-3.patch is similar to 20335-2.diff but uses the user_settings API and doesn't store the $_REQUEST value directly (security is always a good thing :) ).

comment:9 jeremyfelt3 months ago

  • Component changed from Administration to Posts, Post Types
  • Focuses admin added

comment:10 helen6 weeks ago

Related: #16774

ericmann6 weeks ago

Refreshed patch

Note: See TracTickets for help on using tickets.