How to change any text string

There are times you don’t want to translate the whole installation of WordPress or one of its plugins such as WooCommerce. Here’s a little line of code which will work for you instantly.

add_filter( 'gettext', function($translated) {
        $translated = str_ireplace( '(can be backordered)', '', $translated );
        return $translated;
, 999 );


One Comments

  • Raj

    August 12, 2020

    Can you explain more about what this snippet will do?

    The way I read your title, i thought it was going to be a snippet that will allow me to change some text that appears somewhere on WP/Woo?


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.