How to change any text using WordPress gettext Filter

  • Update On January 15th, 2017
  • in WordPress

This post was last updated on January 15th, 2017 at 06:10 pm

Using WordPress gettext filter is the easy way to change any text anywhere in our WordPress site. It is simple to use, and the main purpose of this filter is to allow us to change text in our WordPress core, WordPress themes, WordPress plugins without changing the original code. It is a great way to easily customize labels, headings, button text, and any other text we wish to change. This example assumes that there is no other method for changing the label.

add_filter( 'gettext', 'change_label_names', 20, 3 );
function change_menu_label( $translated ) {  
    $translated = str_replace("Login", "Profile", $translated );
    return $translated;

Note: Use it cautiously, as it runs on every single string in WordPress core which could lead to a performance issue.

About This Author

My name is Parameshwar Roy (P. Roy), and I am a web developer. This is my personal blog to record my own thoughts. Though I am not a natural writer, I love to share my experiences. Hope my experiences will be useful to more about me

Leave A Reply