This alert shows when you click Delete Permanently on a media (attachment) item.
My Goal: I want to change the text of the alert if the current user has a certain custom meta value. Also, changing wordpress core is not an acceptable answer because updates would wipe my code.
I see this message's text is set in 2 places:
Here is the relevant code from
script-loader.php for your convenience:
did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array(
'warnDelete' => __( "You are about to permanently delete these items from your site.\nThis action cannot be undone.\n 'Cancel' to stop, 'OK' to delete." ),
'dismiss' => __( 'Dismiss this notice.' ),
'collapseMenu' => __( 'Collapse Main menu' ),
'expandMenu' => __( 'Expand Main menu' ),
I tried preventing the alert and adding my own via jquery, but this is not a good solution. Can I re-localize the "common" script myself with my message as the
warnDelete maybe? Any ideas would be much appreciated.