1

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.

How can I do that from functions.php?

Any help would be appreciated.

0

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');
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.