Skip to content

Instantly share code, notes, and snippets.

@elimn
Last active January 23, 2018 21:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save elimn/877bc90421526d22900b to your computer and use it in GitHub Desktop.
Save elimn/877bc90421526d22900b to your computer and use it in GitHub Desktop.
MT | TEC | Fix for Single Event 404s with attachment set in WP Query
<?php
/*
* Possible solution for Single Event page 404 errors where the WP_Query has an attachment set
* IMPORTANT: Flush permalinks after pasting this code: http://tri.be/support/documentation/troubleshooting-404-errors/
*/
function tribe_attachment_404_fix () {
if (class_exists('TribeEvents')) {
remove_action( 'init', array( TribeEvents::instance(), 'init' ), 10 );
add_action( 'init', array( TribeEvents::instance(), 'init' ), 1 );
}
}
add_action( 'after_setup_theme', 'tribe_attachment_404_fix' );
@andrasguseo
Copy link

Thanks for sharing that info @incredimike. I have forked the snippet and adjusted it. You can find it here:
https://gist.github.com/andrasguseo/b3283cb4503c880a205448dbafc19f7b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment