• Resolved David Goring

    (@dg12345)


    You should be using the home_url for your urls

    site_url is the url of the WordPress installation

    home_url is the url of root of the website

    While they are often the same they can be different and its important for when they are different to use the home_url

    On my site where we use a bedrock style to install wordpress and all the plugins
    The urls are different and so your plugin doesn’t work

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter David Goring

    (@dg12345)

    Hacky fix to get round the issue for now

    if(class_exists('ConveyThis'))
    {
      add_filter('site_url', function ($url) {
          $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 5);
    
          foreach($trace as $index => $breakpoint)
          {
            if($breakpoint['file'] == WP_CONTENT_DIR . '/plugins/conveythis-translate/index.php')
            {
              return home_url();
            }
          }
    
          return $url;
      });
    }
    Plugin Author ConveyThis

    (@conveythis)

    Not sure whether it is a valid fix, but thanks for sharing.
    Probably some users will find it helpful!

    Thread Starter David Goring

    (@dg12345)

    Please can you implement my initial suggested fix

    My Hacky fix above is only to be used until you update to use home_url() instead of site_url()

    Thread Starter David Goring

    (@dg12345)

    @conveythis Can you please implement my suggested fix

    Plugin Author ConveyThis

    (@conveythis)

    Great news @dg12345
    This fix has been implemented and released in the newest version of our plugin!
    Enjoy!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘home_url instead of site_url’ is closed to new replies.