Home › Forums › Calendar Products › Events Calendar PRO › Enable 404's not soft 404's
- This topic has 2 replies, 3 voices, and was last updated 10 years, 3 months ago by
Support Droid.
-
AuthorPosts
-
December 31, 2015 at 2:58 am #1048319
Casey
ParticipantHi,
I’ve gone through the forums and have read that in a recent update the day pages with no events (e.g. 2015-07-03/) were change to return a soft 404 (HTTP 200), i need those pages to return a 404 error (opposite of what most people want it know). I would rather the site return a 404 than a page that isn’t relevant.
Is there somewhere in the code i can change the response code for these pages?
Thanks in advance.
January 2, 2016 at 4:36 pm #1049166George
ParticipantHey @Casey,
Thanks for reaching out. This is unfortunately a bit tricky to do 🙁 For a quick example, you can look at the code that we used to share in the past for changing our “Hard” 404s to a 200 status:
add_filter( 'status_header', 'tribe_no_event_404s_allowed' );function tribe_no_event_404s_allowed( $status ) {
global $wp_query;// If The Events Calendar hasn't loaded/is not activated we should not interfere
if ( ! function_exists( 'tribe_is_event_query' ) ) return $status;// If the current query is not event related we should not interfere
if ( ! tribe_is_event_query() ) return $status;// Convert 404s into 200s
if ( false !== strpos( $status, '404 Not Found' ) )
$status = 'HTTP/1.1 200 OK';return $status;
}
Here, you’ll see that for Event Queries that return a 404 Not Found error, they are changed to the 200 status regardless of context.
But basically everything not-broken would return a 200 status, so you can’t use this approach for switching 200 status responses to 404 responses as easily.
I unfortunately cannot think of a way to pull of exactly what you mean – even with the fact that this behavior should only be limited to Day View items, there is unfortunately not enough context provided to determine whether a 200 response is because of a “true” success, or a “soft 404″…
Let me know what you think about all of this!
Cheers,
GeorgeFebruary 18, 2016 at 8:33 am #1076424Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Enable 404's not soft 404's’ is closed to new replies.
