Skip Navigation

Open

Reported for: WPML Multilingual CMS 4.4.10

Overview of the issue

If your WordPress site has different values for the WordPress Address (Site URL) and Site Address (Home URL) options in SettingsGeneral, it may conflict with features that depend on the REST API.

For example, the Advanced Translation Editor may not work as expected, and you will see 403 JavaScript errors on the browser console when you try to send or open a translation job.

Workaround

Before proceeding make a full backup of your site.

  1. Open your theme functions.php file.
  2. Add the following code snippet:
    add_filter( 'rest_url', 'wpmldp_replace_rest_url', 10, 4 );
    function wpmldp_replace_rest_url( $url, $path, $blog_id, $scheme ){
        //Get URL's
        $siteurl = get_site_url();
        $homeurl = get_home_url();
        //Replace 
        $url = str_replace($homeurl, $siteurl, $url);
        
        return $url;
    }
    

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>