ryelle/Foxhound

Attachment URL

Opened this issue · 3 comments

Currently the url pattern of /attachment/<:id> is supported. However attached uploaded to posts generate urls like this /<:year:>/<:month:>/<:slug:>/<attachment_slug> . This pattern doesn't have route and 404s

All attachments (including uploads) should be redirecting to the /attachment/:id page if loaded from the server (code), and attachment links in the JS-rendered content should also be caught by a JS click handler to generate and load the /attachment/:id route (code).

Is one of these two not working for you? Can you share a link to a test site, or even just a screen recording, of it not working? Thanks!

I can't as I was only testing it on my VVV install. But here is a screenshot. It is in galleries that there is an issue.

screenshot from 2017-09-09 21-59-10

I dont have jetpack installed on my VVV install.

Added the following to permalink file.

add_filter( 'attachment_link', array( $this, 'attachment_link' ), 10, 2 );
	}

    function attachment_link($link, $post_id) {

	    return home_url( '/attachment/' . $post_id );
    }