EP_ATTACHMENT
will insert rules for things attached to posts (and custom post types), but not unattached media.
You can make this work by adding it to EP_PAGES
instead-
add_rewrite_endpoint( 'foo', EP_PAGES );
EP_ATTACHMENT
will insert rules for things attached to posts (and custom post types), but not unattached media.
You can make this work by adding it to EP_PAGES
instead-
add_rewrite_endpoint( 'foo', EP_PAGES );