WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Too many redirects on attachment (5 posts)

  1. Ottens
    Member
    Posted 1 year ago #

    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?

  2. Ottens
    Member
    Posted 1 year ago #

    I found the Permalink Fix & Disable Canonical Redirects Pack plugin takes care of the problem but I would love to have a better solution.

  3. Ottens
    Member
    Posted 1 year ago #

    Turns out the plugin interferes with the WPtouch plugin... :(

  4. Ottens
    Member
    Posted 1 year ago #

    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?

  5. Ottens
    Member
    Posted 1 year ago #

    I found that removing the following part from the code

    . main '#main'

    did the trick.

Topic Closed

This topic has been closed to new replies.

About this Topic