Make WordPress Core

Opened 4 years ago

Closed 2 years ago

#18710 closed enhancement (fixed)

post_deleted_messages filter

Reported by: jgadbois Owned by: nacin
Milestone: 3.7 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch commit
Focuses: Cc:


It would be nice to be able to updated post deleted messages like you can through the post_updated_messages filter.

Attachments (4)

18710.patch (4.7 KB) - added by johnbillion 4 years ago.
18710.diff (5.3 KB) - added by johnbillion 2 years ago.
Refreshed patch
18710.2.diff (5.0 KB) - added by nacin 2 years ago.
18710.3.diff (5.5 KB) - added by nacin 2 years ago.

Download all attachments as: .zip

Change History (18)

comment:1 @SergeyBiryukov4 years ago

You mean "Item moved to the Trash" and similar strings in wp-admin/edit.php?

comment:2 @jgadbois4 years ago

Yes, exactly

comment:3 @DrewAPicture4 years ago

+1 to this. Can currently set 'Custom field deleted' but not 'Post moved to the trash.'

comment:4 @johnbillion4 years ago

Related: #18714

Last edited 4 years ago by johnbillion (previous) (diff)

comment:5 @johnbillion4 years ago

  • Owner set to johnbillion
  • Status changed from new to accepted

@johnbillion4 years ago

comment:6 @johnbillion4 years ago

  • Component changed from General to Administration
  • Keywords has-patch added; needs-patch removed

Patch which adds a bulk_post_updated_messages filter. No new strings introduced.

Plugin usage:

function bulk_foo_updated_messages( $messages, $counts ) {
	$messages['foo'] = array(
		0 => '',
		1 => _n( '%s foo updated.', '%s foos updated.', $counts[1], 'foo' ),
		2 => _n( '%s foo not updated, somebody is editing it.', '%s foos not updated, somebody is editing them.', $counts[2], 'foo' ),
		3 => _n( 'Foo permanently deleted.', '%s foos permanently deleted.', $counts[3], 'foo' ),
		4 => _n( 'Foo moved to the Trash.', '%s foos moved to the Trash.', $counts[4], 'foo' ),
		5 => _n( 'Foo restored from the Trash.', '%s foos restored from the Trash.', $counts[5], 'foo' ),
	return $messages;
add_filter( 'bulk_post_updated_messages', 'bulk_foo_updated_messages', 10, 2 );

comment:7 @nacin4 years ago

  • Keywords 3.4-early added
  • Milestone changed from Awaiting Review to Future Release
  • Owner changed from johnbillion to nacin

comment:9 @markoheijnen3 years ago

  • Cc markoheijnen added

About the patch, the fallback to post is wrong. This should be to the current messages since someone can remove post from the array.

Also ticket #20898 is not a duplicate ticket but related. It's only duplicated when the current patch will be committed.

@johnbillion2 years ago

Refreshed patch

comment:10 @johnbillion2 years ago

  • Keywords 3.4-early removed

Patch refreshed.

comment:11 @SergeyBiryukov2 years ago

  • Milestone changed from Future Release to 3.7

comment:12 @helen2 years ago

  • Keywords needs-docs added

@nacin2 years ago

@nacin2 years ago

comment:13 @nacin2 years ago

  • Keywords commit added; needs-docs removed

18710.3.diff adds docs, avoids magic numbers, and tries to simplify the logic.

The post_updated_messages filter uses 1-10 to correspond to actual ?message=X arguments. I figured this filter could benefit from a bit more structure.

comment:14 @nacin2 years ago

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

In 25577:

Introduce a bulk_post_updated_messages filter.

props johnbillion for initial patch.
fixes #18710.

Note: See TracTickets for help on using tickets.