Trailing Slashes for PDF Documents

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    I can suggest that you add the following filter in your theme’s functions.php file to remove the trailing slash:

    add_filter( 'attachment_link', 'modify_local_attachment_links', 10, 2 );
    function modify_local_attachment_links( $link, $id )
        $link = unstrailingslashit($link); 
        return $link;

    Looking forward to helping you. Thank you.


    Hi Michael,

    thanks for your reply. I tried to add this code to my functions.php file, but it didn’t change the behaviour of RankMath – the trailing slash is still there.

    Any ideas why this could be?

    – Martin

    Hi Martin,

    Apologies for the delay.

    I have raised this issue with our dev team and we will be getting back to you in a short while.

    We appreciate your patience. Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this ticket.