pikerr Posted June 24, 2019 Share Posted June 24, 2019 (edited) Dear All, I have quite a lot of duplicate content ever since I have enabled the currency options in WHMCS. It appears in announcement, checkout, index, cart, contact, submitticket, supportticket etc. I wonder if can use ClientAreaHeadOutput to set canonical tag. For example, Im looking at the below links (WHMCS installation folder is https://example.com/client) https://example.com/client/index.php?rp=%2Fannouncements%2F3%2FCompleted-Migration-of-Physical-Assets-in-Chicago-Data-Center.html&currency=1 https://example.com/client/index.php?rp=%2Fannouncements%2F2%2FImportant-Announcement-Migration-of-Physical-Assets-in-Chicago-Data-Center.html&currency=10 I have tried to create ClientAreaHeadOutput hooks however it does not work , any advice? add_hook('ClientAreaHeadOutput', 1, function($vars) { $SystemURL = 'https://example.com/client'; $Page = 'whatever'; return <<<HTML <link rel="canonical" href="https://{$SystemURL}/{$Page}"/> HTML; }); Thank you Edited October 15, 2019 by WHMCS ChrisD Removed link at posters request 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted June 24, 2019 Share Posted June 24, 2019 It works on my WHMCS. 0 Quote Link to comment Share on other sites More sharing options...
pikerr Posted June 25, 2019 Author Share Posted June 25, 2019 Dear Kian, Just to confirm, since $SystemURL = 'https://example.com/client'; Is there a need to write href="https://{$SystemURL}/{$Page}"/> will it be a duplicate of https:// ? I have saved this hook in /includes/hooks /canonicaltag.php . This should work ? And advice? Thank you 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted June 26, 2019 Share Posted June 26, 2019 (edited) Of course you should not use "https://" twice. The href have to be like follows: <link rel="canonical" href="https://example.com/client/cart.php"/> Edited June 26, 2019 by Kian 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.