I am attempting to create a small PDF image that links to a specific PDF. I have uploaded the image and PDF to media. I can add in the image and then I go to edit it. I change the "Link To" section to the URL for my uploaded PDF, and then I check "Open link in new tab" and press update. The "Image Details" window closes, but when I go back to that image and click edit again nothing has been updated, and I can confirm it does not function when I update my site and check on the actual site (not in wordpress).
I can edit the html manually and change the href to the url and it will work, but that still doesn't allow me to set it to open in a new tab... although I'm sure there's some way to do that in html. I would really like the visual editor to just work.
Any help would be appreciated.
Solved! Go to Solution.
Whenever WordPress does not behave as it should, that typically indicates a conflict of some sort. In most cases a plugin, and sometimes even your theme. We do this by process of elimination.
The best way to do all this testing without disrupting your live site is to using a staging environment if your plan comes with that option.
You can test this theory by disabling all your plugins and then see if the issue resolves itself. If it does, you know you have a plugin that isn't playing nicely with others. Reactivate one-by-one until the issue resurfaces and you know which plugin has to go.
Check that all your plugins are compatible and tested up to version 5.1. While some plugins will still work, by not having plugins that are not keeping up with WordPress you run the risk of conflicts.
If it isn't plugins, it could be your theme. You can run your situation by the developer (noting you already eliminated a plugin conflict) and ask if they are aware of any issues. Or, you can deactivate you theme and use the WordPress default Twenty Nineteen theme to see if the issue resolves. If it does -- you know it is your theme.
You can add the following to your HTML link code to open a new window:
I know you want the visual editor to 'just work'. Me too for over a decade! Now I just turn the darn thing off asap! That said, you could always try adding the simple(ish) code like below:
<a href="http://mysite.com/myfile.pdf" target="_blank"> <img alt="pdf file descript" src="mypdfimg.png" style="width:20px;height:20px;">
You don't need the width and height styling - just there for illustration purpose. But both your image and .pdf files are targeted and, this will work.