Media Links

  • Guys, this is a major problem.
    I just realized that all media are either redirected to its parent page, or opens the media page.
    In Yoast, there is a possibility to link directly to the media file (e.g.: PDF file)
    This is urgent, and critical for all my websites

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

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

    You can disable this redirection of media links by heading over to Rank Math > General Settings > Links > Redirect Attachments as shown below:

    Let us know how this goes. Thank you.


    Not good, cause when using ACF, and adding link field, the link is going automaticly to the media page, and not to the image itself.
    With yoast, when using this feature, there is no problem and the PDF opens, but when I tried the same (I already tried what you wrote before opening this ticket) with your plugin, Instead of getting the PDF file, I got the media page…
    Big problem guys

    HI there,

    Thanks for the follow up.

    You can make use of the following code to change the redirect_url:

     * Redirect the attachment to its parent post.
     * @param string $redirect URL as calculated for redirection.
    add_filter( 'rank_math/frontend/attachment/redirect_url', function( $redirect ) {
    	return $redirect;

    I hope this info helps.

    thanks for the quick fix, but this is something you should add into dev department for a permanent fix for all users guys,
    In 99% of the installations, this is a must have.


    I am glad that this info proved useful.

    I will log this as a suggestion for our dev team and hopefully this will be added to our future development roadmap.

    Thank you.

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

The ticket ‘Media Links’ is closed to new replies.