How to change button, or other text on entire WordPress site

I have received a few requests from users about how they can change the wording on things such as buttons, or even “Resumes” in general.  Even though this is out of the scope of the WP Job Manager Field Editor plugin, I will show you in this tutorial how to easily change pretty much any wording on your WordPress site thanks to the integrated translation functionality and actions.

You have two methods to do this, you can either use the free WordPress Plugin called SayWhat or you can add your own PHP code in your functions.php  file (in your theme directory).

Say What? Plugin

This is very straight forward, enter the exact phrase you are looking to replace and voila!  Make sure you set the correct text domain otherwise it will not work correctly!  You can find the correct text domain by looking at the code of the plugin you want to change the text in, and where you see the string it should look similar to this:

__( ‘Company Details’, ‘wp-job-manager’ );

The text domain is the second argument in the function call.  In the example above, the text domain is wp-job-manager

Some common text domains:

WP Job Manager: wp-job-manager

WP Resume Manager: wp-job-manager-resumes

WP Job Manager Field Editor: wp-job-manager-field-editor

Check the plugin’s site for more details and documentation:
https://wordpress.org/plugins/say-what/screenshots/

I recommend you use the Say What? plugin if you are not comfortable using PHP!

PHP Code

You can also easily replace text by using the example below and placing it inside your functions.php  file.  In the example below i’m going to show you how to replace the Update resume text in the button created by WP Job Manager Resumes.

First you need to find what the exact string is that was used in the code.  A lot of times you can do this by simply looking the in “lang” or “language” folder for the translation files, but for this example I will point out the exact spot in the code:

get_job_manager_template( 'resume-submit.php', array(
	'class'              => __CLASS__,
	'form'               => self::$form_name,
	'resume_id'          => self::get_resume_id(),
	'action'             => self::get_action(),
	'resume_fields'      => self::get_fields( 'resume_fields' ),
	'submit_button_text' => __( 'Update resume →', 'wp-job-manager-resumes' )
), 'wp-job-manager-resumes', RESUME_MANAGER_PLUGIN_DIR . '/templates/' );

As you can see in the highlighted section above on line 7 the __( ‘Translatable Text’ )  internal WordPress function is being called and this is how you are able to change the text.  Using that exact string, you can see in the code below how to change the text.

add_filter( 'gettext', 'replace_preview_resume_text', 10, 3 );

function replace_preview_resume_text( $translation, $text, $domain ){

    if( $text === 'Update resume →' ) {
        $text = 'Update Profile →';
    }

    return $translation;
}

 

I will not provide support regarding this and I have created this basic tutorial just for reference.

Total 18 Votes

Tell us how can we improve this post?

+ = Verify Human or Spambot ?