SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)
WHERE 1=1 AND (
wp_term_relationships.term_taxonomy_id IN (18)
) AND wp_posts.post_type IN (‘tribe_events’, ‘post’) AND ((wp_posts.post_status = ‘publish’))
GROUP BY wp_posts.ID
ORDER BY wp_posts.post_date DESC
LIMIT 0, 30
I placed code to examine the SQL query in this file. …./wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php. Prior to the
“$query_result = $posts_query->query( $args )”
line running (and after the “apply_filters” call for “rest_{$this->post_type}_query”), I explicitly set $args[‘post_type’] = ‘post’; I would expect this to only pull posts, no tribe events.
I’ve also validated that the “Include events in main blog loop” was disabled. It’s actually always been disabled, so I don’t think there could be any caching issues related to still seeing it.
Any help around how to not have tribe_events post_type automatically inserted for Rest API queries would be appreciated!
Thank you!
]]>$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 4,
'orderby' => 'date',
'order' => 'DESC',
);
$posts = new WP_Query($args);
When that executes, I am seeing posts of type ‘tribe_events’ and ‘post’. I can see that somehow the ‘tribe_events’ post type is getting inserted into my SQL query as well.
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
WHERE 1=1
AND wp_posts.post_type IN ('post', 'tribe_events')
AND ((wp_posts.post_status = 'publish'))
ORDER BY wp_posts.post_date DESC
LIMIT 0, 4
How is the post type ‘tribe_events’ getting inserted into my custom query? I only see this happening on the front end of my site too. When I disabled The Events Calendar plugin, the issue went away. I tried different themes and this didn’t help either.
The Events Calendar version 6.0.4
Wordpress version 6.1.1
function ghostpool_restrict_logged_out_user_access() {
if ( is_user_logged_in() ) {
return;
}
if ( is_post_type_archive( 'tribe_events' ) ) {
wp_redirect( home_url( '/' ) );
}
}
add_action( 'template_redirect', 'ghostpool_restrict_logged_out_user_access' );
I’ve tested this with all other plugins disabled, using the default Twenty Twenty-One theme, with high and low priorities for the action, and the issue still occurs.
]]>I’m currently using JetEngine plugin with Elementor, in order to generate templates of different CPT in my site. So far, so good. Everything is looking great, and I cant create relationships between every single piece of content.
But here is where Tribe_Events id driving me nuts.
For some reason, the Tribe_events CPT seriously neglects the past events. For this CPT is like past events are an illness or something. If I try to list my Tribe_events post types the past events are like inexistent.
In fact, If I create a relationship, for example between a CPT called COUNTRIES and the Tribe_events CPT with JetEngine, I can’t associate a Past Event to a City.
For some reason Tribe_events CPT, completely overrides the classic WordPress post functionality.
So here is my question: How can I stop Tribe_events logic, from neglecting my Past events? There exist a Hook or a filter, that somehow eliminates this neglecting behaviour? I need a “pure” manipulation of Tribe_events CPT, in order to show them accordingly. I can’t stick to TEC if I can’t solve this
I wanted to use some of the pro features in the future, but I need to solve this first.
]]>I would like to make an Event custom post type sticky on the home page of my website so that if there is a sticky Event custom post it appears, but if not, then my non-Event Posts marked sticky appear. Here is the code I would like to use:
$argsSticky = array(
'posts_per_page' => 1,
'post__in' => get_option('sticky_posts'),
'post_status' => array('publish', 'future'),
'post_type' => array('post','tribe_events'),
'order' => DESC,
'caller_get_posts' => 1
);
Is there any way to do this? Somehow, I am guessing when I imported my events, Sticky was added to one of my Events and the code above worked perfectly. When I removed the Category from the Event custom post type, the Sticky assignment went away and I cannot get it back.
If I could use the Featured Event or Sticky in Month view hook in my query, that could work too. For some reason tag and category aren’t working, e.g.,
$query = new WP_Query( array( 'post_type' => 'tribe_events', 'showposts' => 1, 'order' => 'ASC' ), array( 'tag' => 'sticky' ) );'
$query = new WP_Query( array( 'post_type' => 'tribe_events', 'showposts' => 1, 'order' => 'ASC' ), array( 'cat' => 58 ) );
And when I use these queries, the Event always appears whether or not it has the specified tag or is in the selected Category.
Thank you in advance,
Donna
I have a problem with Title of the event page. There is a string ‘tribe_events’ in the title and can’t find it in the code. The site is https://chitalishte.to/events/ and can see it if i described it wrong.
Please, give me an advise, because I lost two days and can’t solve this.
Thank you in advance for your attention
]]>https://www.ads-software.com/plugins/the-events-calendar/
]]>
add_action('init', 'my_custom_init');
function my_custom_init() {
add_post_type_support( 'tribe_events', 'revisions' );
}
It’s been really handy to be able to track post revisions with The Events Calendar. Any ideas what might be causing this bug? Thanks!
https://www.ads-software.com/extend/plugins/the-events-calendar/
]]>https://www.ads-software.com/extend/plugins/the-events-calendar/
]]>