Support » Fixing WordPress » Too many redirects on attachment

  • Resolved Ottens

    (@ottens)


    I can’t seem to access attachments on my blog. This is the error message i get from Safari:

    Too many redirects occurred trying to open “URL”. This might occur if you open a page that is redirected to open another page which then is redirected to open the original page.

    What’s up?

Viewing 4 replies - 1 through 4 (of 4 total)
  • I found the Permalink Fix & Disable Canonical Redirects Pack plugin takes care of the problem but I would love to have a better solution.

    Turns out the plugin interferes with the WPtouch plugin… 🙁

    Located the problem!

    In functions.php there’s this snippet:

    /**
     * Filter in a link to a content ID attribute for the next/previous image links on image attachment pages
     */
    function toolbox_enhanced_image_navigation( $url ) {
    	global $post;
    	if ( wp_attachment_is_image( $post->ID ) )
    		$url = $url . '#main';
    	return $url;
    }
    add_filter( 'attachment_link', 'toolbox_enhanced_image_navigation' );

    If I take it out, the redirect loop disappears but judging from the description (“previous/next”) it also means I can’t have galleries now anymore?

    I found that removing the following part from the code

    . main '#main'

    did the trick.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Too many redirects on attachment’ is closed to new replies.