attachment_link filter hook not passing ID
-
Hi,
I’m trying to modify the attachment permalinks with the corresponding hook, but I’m having an issue: the attachment ID doesn’t get passed to the function.
Here’s my code:function __filter_attachment_link( $link, $id ) { return preg_replace( '#attachment/(.+)$#', 'photo/'.$id, $link ); } add_filter( 'attachment_link', '__filter_attachment_link' );
I get the following error: “Warning: Missing argument 2 for __filter_attachment_link() in …”
Although in the Filter Reference it says “Filter function arguments: link URL, attachment ID”.
Does anybody have an idea what is the problem here?
Thanks in advance.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘attachment_link filter hook not passing ID’ is closed to new replies.