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:
* 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' );

This comment has been minimized.

Copy link

@campanillasalsera campanillasalsera commented May 13, 2019

I get this message when I try to add this snippet to the functions.php in the child theme though the word press pannel:
No ha sido posible comunicar con el sitio para comprobar los errores fatales, así que el cambio de PHP se ha revertido. Tendrás que subir el cambio a tu archivo PHP por otros medios, como por ejemplo usando SFTP.

I don´t know how to do what its says.


This comment has been minimized.

Copy link

@femms femms commented May 18, 2019

Hi campanillasalsera,
try to delete <?php when copy the snippet in a functions.php that already have it.


This comment has been minimized.

Copy link

@cre-mer cre-mer commented Jul 30, 2020

I have WP installed in german and when I click on list view the url is instead of .../list/. I keep getting `post_type => attachement´ when I debug with the following code snippet:


This comment has been minimized.

Copy link
Owner Author

@andrasguseo andrasguseo commented Jul 30, 2020

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
You can’t perform that action at this time.