Skip to content

Instantly share code, notes, and snippets.

@andrasguseo
Forked from elimn/tribe_attachment_404_fix.php
Last active September 23, 2022 03:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrasguseo/b3283cb4503c880a205448dbafc19f7b to your computer and use it in GitHub Desktop.
Save andrasguseo/b3283cb4503c880a205448dbafc19f7b 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/
* Updated to work with post 3.10 versions
*/
function tribe_attachment_404_fix () {
if (class_exists('Tribe__Events__Main')) {
remove_action( 'init', array( Tribe__Events__Main::instance(), 'init' ), 10 );
add_action( 'init', array( Tribe__Events__Main::instance(), 'init' ), 1 );
}
}
add_action( 'after_setup_theme', 'tribe_attachment_404_fix' );
@andrasguseo
Copy link
Author

Hi @cre-mer,

The issue you are having is not a 404 issue and not related to the above snippet. It is likely an issue with the plugin, which I believe should have been fixed with the latest release.

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