• I haven’t noticed this on any of my WP sites except the new one I just set up. I’m trying to upload a few files, and right on the front page, I’m putting a link to a PDF file. I upload the file (using the browser uploader, since Flash 10 broke the flash uploader), and for the link type, I choose “Link To File” and insert. When I go to the HTML view, I confirm that the link does point to “http://www.kungfu-silat.com/wp-content/uploads/2008/11/gungfuad.pdf”

    However, as soon as I hit Save, that link changes to “http://www.kungfu-silat.com/home/gungfuad” (the “post” location of the file). If I manually change the URL back and save again, it reverts again upon save.

    The file is present and accessible. I can get to it without any problem by using the direct URL. It’s just that WordPress won’t let me save that URL in the page. What gives?

Viewing 9 replies - 16 through 24 (of 24 total)
  • jamaas

    (@jamaas)

    Thanks again, showing my ignorance here but does this “images” directory have to be in .public_html directory?

    Jim

    Samuel B

    (@samboll)

    you can use any folder – that is just the one I used…but yes it has to be somewhere in public_html as that is the root of your site.

    matstillo

    (@matstillo)

    Going back to the original problem, as wjnielsen says up above, this is a real problem for those of us who have set clients up with WordPress to provide CMS capabilities.

    We’re not trying anything too exotic here. All I want is for clients to add pdf links to their home page, and thats it. But they need to be able to do this without having to go into html view, which they cannot do & will not want to do. Is there any progress on the bug trac as this must be affecting quite a few people?

    I can confirm that stripping out the rel attributes does fix it, but I can’t expect some of my clients to understand a word of that. They will take one look at the code view & 1) freak out, then 2) probably ruin the whole page. Please can we get this resolved so that they can add these links while staying in the visual mode workflow?

    Cheers!

    Anyone looking for a workaround to this issue, here’s how I fixed it:

    Create a file in your theme folder called attachment.php that contains this bit of code: <?php header( 'Location: '.wp_get_attachment_url() ); ?>

    This will immediately redirect the attachment page to the link to the attached file (this will appear seamless for the user).

    Note that this does remove the ability to have attached file pages, though personally I’m not sure why you’d want to link to a page to link to a file to begin with.

    Thank you Spaanem!!! You’ve just made my life a LOT better!!!

    I having this problem too. Bug #7040 looks to be closed. Any one have an update on this bug getting fixed in the next release.

    spaanem, I’ve created the attachment.php file and placed into the theme directory. But it has not fixed the problem.

    The attachment.php file should be in the currently used theme directory correct?

    After I add the file do I need to do anything else before trying it?

    Ok, had to delete the post and create a new one. And the spaanem work around only appears to work on NEW posts, if you modify a current post then it doesn’t work.

    It appears to remove the rel=’ portion of the link, thus when posting WordPress does not change it. But this alloy works for new posts.

    What post? I thought we were talking about static home pages in this thread?

Viewing 9 replies - 16 through 24 (of 24 total)
  • The topic ‘Cannot link directly to PDF file in media library, only to post’ is closed to new replies.