X

How To Replace Words in the WordPress Admin

Snippets by IsItWP

Are you looking for a way to replace words in WordPress admin? This snippet uses the gettext and ngetext filters to replace an array of words in the WordPress admin.

Instructions:

  1. Add this code to your theme’s functions.php file or in a site-specific plugin.
  2. Edit the $words array. Add the words you want to replace to the keys and the replacement text to the keys’ values.
add_filter(  'gettext',  'wps_translate_words_array'  );
add_filter(  'ngettext',  'wps_translate_words_array'  );
function wps_translate_words_array( $translated ) {

     $words = array(
			// 'word to translate' = > 'translation'
			'Posts' => 'Article',
			'Post' => 'Articles',
			'Pages' => 'Stuffing',
			'Media' => 'Upload Images',
			'Links' => 'Blog Roll',
		    );

     $translated = str_ireplace(  array_keys($words),  $words,  $translated );
     return $translated;
}

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: How to Properly Create a Custom Login Page in WordPress (Step by Step).

Comments  Leave a Reply

  1. Thanks for sharing the tips. Simple yet powerful. Wonder will it clash with the custom plugin. but will try this out.

  2. Also besides from wanting to change 7308064.jpg as post title to anpther words can you please help on telling me how to show images while in edit post mode,
    Note i am a newbie but would like to learn
    Thanks

  3. Hi
    Thanks for the great trick wondering if could shed light on the below

    what if i have 7308064.jpg as title how do i go about replacing this to whatever i want

    can i add a shortened link followed by some keywords.

  4. Never forget your Featured Image Dimensions - WPMU.org August 16, 2012 at 10:17 pm

    […] from WPSnipp.com (Update: added “if is_admin” […]

  5. Wow! i didn’t about this before. sometimes for certain scenarios it would be great to rename some WP items, like you did to Posts -> Articles.
    Keep up the great work 😉

    1. Hi Wesam, glad you like the snippet, great if you have a few things within the wordpress admin you want to change. Enjoy the wpsnipp 🙂

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!