zhiyano
Forum Replies Created
-
Forum: Plugins
In reply to: [The Events Calendar] Compatibility with MultilingualPressHi @d0153,
Thank you for your answers. But unfortunately both issues are still unresolved.
Issue #1: The issue can be easily reproduced in a WordPress multisite environment. Simply switch to a different site using
switch_to_blog()
, create an event post withwp_insert_post()
, and then switch back to the original site withrestore_current_blog()
. You’ll notice that the event date is not added to the custom tables.This happens because The Events Calendar processes changes on the
shutdown
hook, which is triggered after switching back to the original site. As a result,get_post_type()
returnsfalse
since it’s checking the$post_id
from a different site.Issue #2: Could you please provide an example how to use?
get_bloginfo('url')
?instead of?tribe_events_get_url()
.I don’t think this is possible. Let’s consider this scenario: I’m on a site with blog ID 2, but I need to get the URL of an event tag or category from a site with blog ID 3. My steps are:
- Switch to the correct blog with
switch_to_blog()
. - Get the event tag or category URL using
tribe_events_get_url()
. - Switch back to the original blog with
restore_current_blog()
and use the URL as needed.
However, the issue is that
tribe_events_get_url()
always generates URLs based on the rewrite rules from the original blog, not the one I switched to. This results in a URL with the event slug from blog ID 2, instead of the correct URL with the slug from blog ID 3.Actually, both issues are not a compatibility issues with MultilingualPress; it’s a general issue with how The Events Calendar handles its logic across multisite.
- Switch to the correct blog with