Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MT | TEC | Fix for Single Event 404s with attachment set in WP Query
* Possible solution for Single Event page 404 errors where the WP_Query has an attachment set
* IMPORTANT: Flush permalinks after pasting this code:
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' );
Copy link

incredimike commented Dec 2, 2017

I think this is incorrect and causes a deprecation warning as of 3.10. Limited testing shows that changing TribeEvents to Tribe__Events__Main seems to fix it. YMMV.

Copy link

SleeplessinDC commented Jan 22, 2018

I agree that this snippet is incorrect. I get the following PHP Notice

PHP Notice: /wp-content/plugins/the-events-calendar/src/deprecated/TribeEvents.php is deprecated since version 3.10! Use Tribe__Events__Main instead. in /wp-includes/functions.php on line 3966

Copy link

andrasguseo commented Jan 23, 2018

Thanks for sharing that info @incredimike. I have forked the snippet and adjusted it. You can find it here:

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