Rename a row action label

I would like to simply rename “Delete permanently” to “Delete”, without having to mess with the WordPress core files.

It’s worth knowing that I’m using a translated version of WordPress. So the “Delete permanently” action is already translated but the translated string is too long to fit my needs.

Read More

How can I do that from functions.php?

Any help would be appreciated.

Related posts

1 comment

  1. Put this in your functions.php file:

    function rename_delete_action($actions) {
        // replace Delete Permanently text, if present
        // (i.e., if the current user is able to delete posts)
        if (isset($actions['delete']))
            $actions['delete'] = preg_replace('@>(.*)<@', '>WHATEVER<', $actions['delete']);
        return $actions;
    } // function rename_delete_action
    
    if ('edit.php' === $GLOBALS['pagenow']) {
        // add filter for Edit pages only
        add_filter('post_row_actions', 'rename_delete_action');
        add_filter('page_row_actions', 'rename_delete_action');
    }
    

Comments are closed.