Permalinks not working in plugin code
-
Hi, I am trying my luck modifying a plugin that pulls in external pages and inserts them as posts. What I want to achieve is to insert image links in an identical way as when you use the media uploader and press “Insert into post”.
After navigating through media.php in wp-admin/includes, I found a couple of function doing this (it is done in many places with different code it seems). Most of them use the function get_attachment_link() for the URL to link the image to. However, when I run it in my code, it does not output permalinks, although permalinks are activated and are outputted when I insert an image manually into a post.
Does it have something do to with the code running before permalinks are initiated, or what is the context required for get_attachment_link() to work? (other permalink functions are also broken at that point in the running code).
The topic ‘Permalinks not working in plugin code’ is closed to new replies.