phpwordpressadvanced-custom-fieldscustom-post-typenotice

Wordpress: Change message given when deleting post from custom post type


So I have a custom post type called members. linked with advanced custom fields. I've made it so if I delete a member from the custom post type it doesn't move to the trash and permanently deletes it. but I still get this message:

enter image description here


I'm trying to change this message.

the line I'm trying to override inside /wp-admin/edit.php is:

'trashed'   => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ),

the code I've tried inside functions.php to change it is as follows:

add_filter( 'post_trashed_messages', function( $messages )
{
    $messages['post'][2] = 'Succesfully deleted';
    return $messages;
} );

I've it's not possible to change it. is it then possible to maybe remove the notice entirely


Solution

  • so how I got it to work is like this:

    add_filter( 'bulk_post_updated_messages', function ( $bulk_messages, $bulk_counts ) {
        $bulk_messages['post']['trashed'] = _n( '%s post successfully deleted.', '%s posts successfully deleted.', $bulk_counts['trashed'] );
        return $bulk_messages;
    }, 10, 2 );