WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 7 months ago

Last modified 5 months ago

#18496 closed feature request (wontfix)

Quick edit loses custom colums and custom order - looks bad

Reported by: anmari Owned by:
Milestone: Priority: normal
Severity: minor Version: 3.2.1
Component: Quick/Bulk Edit Keywords:
Focuses: administration Cc:

Description

Using manage_posts_custom_column, 'manage_posts_columns', 'manage_edit-'.$post_type.'_columns' etc

to add custom columns to the manage edit lists and to change the order of the fields.

If Quick edit is used on a post, the custom columns disappear (visually - a refresh displays them again) and the custom column order is reset just for that post.

This results in a rather buggy looking display. (See attached screenshots). All is okay on a refresh of the page.

I think this is related to http://core.trac.wordpress.org/ticket/17935. (explained differently, but possibly similar cause?)

Attachments (2)

before.png (13.5 KB) - added by anmari 4 years ago.
'Before' quick edit
after-incorrectorder.png (12.8 KB) - added by anmari 4 years ago.
After quick edit, custom cols 'lost' and order of columns reset for that post

Download all attachments as: .zip

Change History (13)

@anmari4 years ago

'Before' quick edit

@anmari4 years ago

After quick edit, custom cols 'lost' and order of columns reset for that post

comment:2 @SergeyBiryukov4 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 3.3

comment:3 @ocean904 years ago

  • Keywords reporter-feedback added

Can you give some example code? Does it happen in 3.2 too?

comment:4 @nacin4 years ago

  • Keywords needs-patch removed
  • Milestone 3.3 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

I can't reproduce this. It's not a bug in core best I can tell — it's something peculiar the few of you are doing. Can we please have some code that can cause this and re-open?

comment:5 @jakemgold4 years ago

Also can't replicate this... tried adding a custom column at the beginning, end, and middle, with no luck.

Could swear I've seen this once before, some time ago, but can't replicate now.

comment:6 @anmari4 years ago

Hi guys,
sorry - will try get back to this and post simple plugin code to recreate. at the moment hard to separate it out from huge plugin with data creation - will try condense to demonstrate - maybe I'll see why then!.

Just wanted to note that I had a quick look still see it in wp 3.2.1 and am wondering whether it is because
1) I've re-ordered the columns to be more meaningful - my gut tells me maybe this is why
2) the custom columns are sortable (using a filter on request and checking for orderby)
3) there are added edit actions
4) post type is hierarchical

I hope to have more time end of week to address this. But just in case anyone has similar situation, thought I'd at least post this for now:

the reorder code re pt 1:

	add_filter('manage_posts_columns', 		'amr_ical_post_columns');
function amr_ical_post_columns ($defaults) {
global $amr_event_post_type;

	if (!does_ical_apply() ) return ($defaults);


		if (isset ($_GET['post_type'])) $posttype= $_GET['post_type'];
		else $posttype= 'post';


	$defaults['title'] = __('Title'); //use default domain
		unset ($defaults['tags']);
		unset ($defaults['author']);
		unset ($defaults['date']);
		unset ($defaults['comments']);
		unset ($defaults['categories']); /* unset so when re-add they will be on  the side */
		unset ($defaults['author']);
	    $defaults['_DTSTART'] = __('Start Date', 'amr-events');
//		$defaults['_DTEND'] = __('End Date', 'amr-events');
		$defaults['_DURATION'] = __('Duration', 'amr-events');
		$defaults['_RRULE'] = __('Repeats', 'amr-events');
		$defaults['_last'] = __('Last', 'amr-events');  // used to manage events only

		$defaults['_LOCATION'] = __('Location', 'amr-events');
		$defaults['categories'] = __('Categories', 'amr-events');
	    $defaults['author'] = __('Author', 'amr-events');
	//	$defaults['date'] = __('Date Created');
	//	$defaults['comments'] = __('Comments');
		$taxonomies = get_taxonomies (
			array(  'public'   => true,
					'_builtin' => false,
					'object_type' => array($posttype)),
			'objects');
		 foreach ($taxonomies as $key => $taxonomy) {
			if (in_array($posttype,$taxonomy->object_type)) /* need to double check as wp is returning ical taxo when post type = post */
				$defaults [$key] = $taxonomy->label;
			}
//		}
	    return $defaults;

comment:7 @anmari4 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened
  • Type changed from defect (bug) to feature request

Just to confirm that yes it is the unset and redefinition to change the order of the columns that is causing the problem. Actually it seems just the unset causes it even without redefining

Bit slow today, but I of course realised that it is so quick to test that and so did.

I am allowing people to use standard posts as events if they want.

Also allowing support of comments etc but did not want to have too much displayed.

so wanted to hide the less necessary columns and change order of others .

There is another way that one could initially hide a column (and user could add back if they wanted using screen options) - basically set the user option. Cumbersome but could work.

But I do not know another way to change the order of the columns. I think this is a valuable thing to be able to do for a user interface point of view. For custom posts, different columns will be more meaningful and so should be more accessible.

So it is this a feature request then - ability to change order of columns in edit screens? I've marked it as such for now.

comment:8 @SergeyBiryukov4 years ago

  • Milestone set to Awaiting Review

comment:10 @DrewAPicture7 months ago

  • Focuses administration added
  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from reopened to closed

This ticket has had no activity in two years, and no patch. There are several plugins available that handle this. Closing as wontfix.

comment:11 @tivnet5 months ago

Possible case

If your code that adds custom columns is within

if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) )

then all custom columns values will disappear after quick edit, because it uses AJAX.

all manage_..._column(s) filters should be placed within if ( is_admin() ) only

Note: See TracTickets for help on using tickets.