Support » Plugin: Asset CleanUp: Page Speed Booster » remove Shortlinks not working

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Gabe Livan

    (@gabelivan)

    @alriksson just retested it and when “Remove Pages/Posts “Shortlink” tag?” is enabled it, the following LINK tag from the HEAD section is removed: <link rel='shortlink' href='https://www.yourdomainhere.com/?p=ID_HERE' />

    Is this what you need?

    • This reply was modified 10 months, 2 weeks ago by Gabe Livan.
    • This reply was modified 10 months, 2 weeks ago by Gabe Livan.

    Correct but it did not work.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    @gabelivan I’ve deleted your offer to login to your user’s site. I’m am 100% sure you mean well but please never ask for credentials. I have flagged your account temporarily. That just means that your post will need to be approved and @ notifications from you will not work.

    https://wordpress.org/support/guidelines/#the-bad-stuff

    Now for the why: The internet is a wonderful place full of very nice people and a few very bad ones. I’m sure everyone here is very nice however, by giving some ones keys to your house you are trusting they wont steal anything. Likewise the person who takes the keys is now responsible for the house FOREVER.

    If something was to go wrong, then you the author may well legally become liable for damages, which they would not normally have been as their software is provided without warranty.

    Please be aware that repeatedly asking for credentials will result in us asking you to repeatedly stop before escalating up to the plugins team.

    It is never necessary for you to do that.

    There are many ways to get information you need and accessing the user’s site is not one of them. That’s going too far.

    You get the idea.

    Volunteer support is not easy. But these forums need to a safe place for all users, experienced or new. Accessing their system that way is a short cut that will get you into real trouble in these forums.

    @gabelivan Do still not worked on our application tried once again with the latest update but <link rel='shortlink' href="https://yourdomain.com/?p=1"> is still displayed.

    imtino

    (@imtino)

    I used to add this snippet code and it works.
    remove_action( 'wp_head', 'wp_shortlink_wp_head');
    But it seems like it’s not working anymore. Any new solution?

    Plugin Author Gabe Livan

    (@gabelivan)

    @alriksson @imtino I’ve updated the current tag, so you can re-download the plugin and it should work now in case the “remove_action” does not work for you (it could be that this action is added again by another plugin/theme after Asset CleanUp is removing it). The following snippet (if you prefer to update functions.php and not re-download Asset CleanUp), would help you out:

    add_action('wp_loaded', function () {
    ob_start(function ($htmlSource) {
    $regExpPattern = '#<link[^>]*shortlink[^>]*(>)#Usmi';

    preg_match_all($regExpPattern, $htmlSource, $matchedLinks, PREG_SET_ORDER);

    if (! isset($matchedLinks[0][0])) {
    return $htmlSource;
    }

    $linkTag = $matchedLinks[0][0];

    if (stripos($linkTag, '<link') === 0 && substr($linkTag, -1) === '>' && strip_tags($linkTag) === '') {
    $htmlSource = str_replace($matchedLinks[0][0], '', $htmlSource);
    }

    return $htmlSource;
    });
    }, PHP_INT_MAX);

    Let me now if it works now!

    • This reply was modified 8 months ago by Gabe Livan.
    imtino

    (@imtino)

    I downloaded it and it still doesn’t remove shortlink from http header.

    Plugin Author Gabe Livan

    (@gabelivan)

    @imtino are you confortable sharing your website’s URL with us? Are you saying the following block of code is still within the <head> and </head> source of your pages even after you clear your caching?
    <link rel='shortlink' href="https://yourdomain.com/?p=1">

    imtino

    (@imtino)

    No, not in the <head> tag but in the http header.

    Plugin Author Gabe Livan

    (@gabelivan)

    @imtino @alriksson You were both right about that. It was only removed from the <head> section of the website, but not the HTTP headers. I didn’t understand what you meant initially. I’ve updated the tag and if you re-download it, it will work this time. I promise 🙂 I’ve tested it several times on various websites and the Shortlink is stripped from the HTTP headers 😉

    @gabelivan okay! yeah, this was the issue for me as well never removed from HTTP headers.

    The new version works perfectly! Thank you.

    Can you post the snippet here?

    Plugin Author Gabe Livan

    (@gabelivan)

    Sure, here it is:

    // <link rel='shortlink' href="https://yourdomain.com/?p=1">
    remove_action('wp_head', 'wp_shortlink_wp_head');
    // link: <https://yourdomainname.com/wp-json/>; rel="https://api.w.org/", <https://yourdomainname.com/?p=[post_id_here]>; rel=shortlink
    remove_action('template_redirect', 'wp_shortlink_header', 11);
    • This reply was modified 7 months, 4 weeks ago by Gabe Livan.
    • This reply was modified 7 months, 4 weeks ago by Gabe Livan.

    @gabelivan why do we need to reinstall? shouldn’t it be a plugin update?

    Plugin Author Gabe Livan

    (@gabelivan)

    I used to do tag updates for every small change and that was very often (almost every day). There were a few complaints about too many updates and what I have been doing instead was updating the tag files and development version, but not update the latest stable tag so people won’t be so annoyed. They can check all the changes made anyway as they are public if they wish to re-install the plugin. It’s usually small/cosmetic changes (in this case, it was specifically for you, for those who use the remove Shortlink feature) that are applied.

    If you guys have any suggestions and believe that tag updates should be released more often, let me know! I realized not everyone will ever be pleased, no matter what, and I’m not referring only to the plugin updates. I’m happy to find something that works well for the majority.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘remove Shortlinks not working’ is closed to new replies.