{"id":1966731,"date":"2025-10-21T05:00:53","date_gmt":"2025-10-21T09:00:53","guid":{"rendered":"https:\/\/theeventscalendar.com\/knowledgebase\/?p=1966731"},"modified":"2026-04-16T12:44:13","modified_gmt":"2026-04-16T16:44:13","slug":"provisional-event-ids","status":"publish","type":"post","link":"https:\/\/theeventscalendar.com\/knowledgebase\/provisional-event-ids\/","title":{"rendered":"Provisional Event IDs in The Events Calendar"},"content":{"rendered":"\n<p>In The Events Calendar, especially when working with recurring events or the custom tables system, you may encounter an ID that looks like a Post ID but is much larger (e.g., <code>10000114<\/code>). This is a <strong>provisional ID<\/strong>, and it refers to a specific <em>occurrence<\/em> of an event, not the parent event post itself.<\/p>\n\n\n\n<p>This guide explains what these IDs are and how to correctly convert them to their corresponding WordPress <code>post-&gt;ID<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\" id=\"h-what-is-a-provisional-id\">What is a Provisional ID?<\/h2>\n\n\n\n<p>The Events Calendar uses a custom table system (<code>wp_tec_occurrences<\/code>) to efficiently store and query individual instances of events, particularly for recurring event series. This system generates its own unique IDs for each occurrence to ensure high performance.<\/p>\n\n\n\n<p>A provisional ID is the unique identifier for a single event occurrence within these custom tables. It is <strong>not<\/strong> the same as the standard WordPress Post ID for the <code>tribe_events<\/code> post type.<\/p>\n\n\n\n<p>You will most likely encounter these IDs when:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Looking at the URL of a single recurring event instance.<\/li>\n\n\n\n<li>Querying the <code>wp_tec_occurrences<\/code> database table directly.<\/li>\n\n\n\n<li>Working with certain hooks and filters related to event occurrences.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-medium-font-size\" id=\"h-the-problem-mismatched-ids\">The Problem: Mismatched IDs<\/h2>\n\n\n\n<p>Standard WordPress functions like <code>get_post_meta()<\/code>, <code>get_the_title()<\/code>, or <code>get_permalink()<\/code> require a standard <code>post-&gt;ID<\/code>. If you pass a provisional ID to these functions, they will fail because there is no post in the <code>wp_posts<\/code> table with that ID.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-medium-font-size\" id=\"h-the-solution-normalize-id\">The Solution: <code>normalize_id()<\/code><\/h2>\n\n\n\n<p>The Events Calendar provides a safe, forward-compatible utility function to resolve a provisional ID back to its proper WordPress Post ID.<\/p>\n\n\n\n<p>The function is a static method: <code>\\TEC\\Events\\Custom_Tables\\V1\\Models\\Occurrence::normalize_id()<\/code><\/p>\n\n\n\n<p>This function accepts an ID (either provisional or a standard Post ID) and will always return the correct, integer-based WordPress Post ID.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\" id=\"h-code-snippet-basic-usage\">Code Snippet: Basic Usage<\/h2>\n\n\n\n<p>Here is a simple example of how to use the function to get the correct Post ID.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ The provisional ID you have (e.g., from a URL or database query).\n$provisional_id = 10000114;\n\n\/\/ Use the normalize_id() method to get the actual WordPress Post ID.\n$event_post_id = \\TEC\\Events\\Custom_Tables\\V1\\Models\\Occurrence::normalize_id( $provisional_id );\n\n\/\/ Always check that you received a valid integer ID before using it.\nif ( is_int( $event_post_id ) &amp;&amp; $event_post_id &gt; 0 ) {\n    \n    \/\/ Now you can safely use the correct ID with any WordPress function.\n    echo &#039;The title of this event is: &#039; . get_the_title( $event_post_id );\n    \n} else {\n    \n    \/\/ The ID could not be resolved.\n    echo &#039;Could not find a valid event for the provided ID.&#039;;\n    \n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading has-large-font-size\" id=\"h-template-customization-selectively-display-an-event-s-featured-image-in-list-view\">Template customization: Selectively display an event&#8217;s featured image in list view<\/h2>\n\n\n\n<p>Imagine a use case where you&#8217;d like to selectively show an event&#8217;s featured image in list view calendar display based on a category that the event is associated to. &#8212; In this use case, the <a href=\"https:\/\/docs.theeventscalendar.com\/reference\/functions\/tribe_event_in_category\/\">tribe_event_in_category()<\/a> function would be useful. However, if you have recurring events, this can have undesired effects. Read on for the solution.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-medium-font-size\" id=\"h-1-template-customization\">1. Template customization<\/h2>\n\n\n\n<p>In this use case, we&#8217;d be interested in customizing the <code>\/wp-content\/plugins\/the-events-calendar\/src\/views\/v2\/list\/event.php<\/code> file (see <a href=\"https:\/\/theeventscalendar.com\/knowledgebase\/template-customization-example\/\">Template Customization Example<\/a>) so make a copy of the file and place it in your site&#8217;s <code>\/wp-content\/themes\/[your-theme]\/tribe\/events\/v2\/list\/<\/code> folder.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-medium-font-size\" id=\"h-2-using-the-tribe-event-in-category-function\">2. Using the <em>tribe_event_in_category()<\/em> function<\/h2>\n\n\n\n<p>Edit the <code>\/wp-content\/themes\/[your-theme]\/tribe\/events\/v2\/list\/event.php<\/code> file, and replace its contents with the following:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n&lt;?php\n$container_classes = &#x5B; &#039;tribe-common-g-row&#039;, &#039;tribe-events-calendar-list__event-row&#039; ];\n$container_classes&#x5B;&#039;tribe-events-calendar-list__event-row--featured&#039;] = $event-&gt;featured;\n\n$event_classes = tribe_get_post_class( &#x5B; &#039;tribe-events-calendar-list__event&#039;, &#039;tribe-common-g-row&#039;, &#039;tribe-common-g-row--gutters&#039; ], $event-&gt;ID );\n\n$the_event_id = \\TEC\\Events\\Custom_Tables\\V1\\Models\\Occurrence::normalize_id ($event-&gt;ID);\n?&gt;\n&lt;div &lt;?php tec_classes( $container_classes ); ?&gt;&gt;\n\n\t&lt;?php $this-&gt;template( &#039;list\/event\/date-tag&#039;, &#x5B; &#039;event&#039; =&gt; $event ] ); ?&gt;\n\n\t&lt;div class=&quot;tribe-events-calendar-list__event-wrapper tribe-common-g-col&quot;&gt;\n\t\t&lt;article &lt;?php tec_classes( $event_classes ); ?&gt;&gt;\n\t\t\t&lt;?php \n\t\t\t\tif (tribe_event_in_category (&#039;generated&#039;, $the_event_id)) {\n\t\t\t\t\t$this-&gt;template( &#039;list\/event\/featured-image&#039;, &#x5B; &#039;event&#039; =&gt; $event ] );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\techo(&#039;&lt;div&gt;&lt;p&gt;No featured image to show&lt;\/p&gt;&lt;\/div&gt;&#039;);\n\t\t\t\t}\n\t\t\t?&gt;\n\n\t\t\t&lt;div class=&quot;tribe-events-calendar-list__event-details tribe-common-g-col&quot;&gt;\n\n\t\t\t\t&lt;header class=&quot;tribe-events-calendar-list__event-header&quot;&gt;\n\t\t\t\t\t&lt;?php $this-&gt;template( &#039;list\/event\/date&#039;, &#x5B; &#039;event&#039; =&gt; $event ] ); ?&gt;\n\t\t\t\t\t&lt;?php $this-&gt;template( &#039;list\/event\/title&#039;, &#x5B; &#039;event&#039; =&gt; $event ] ); ?&gt;\n\t\t\t\t\t&lt;?php $this-&gt;template( &#039;list\/event\/venue&#039;, &#x5B; &#039;event&#039; =&gt; $event ] ); ?&gt;\n\t\t\t\t\t&lt;?php $this-&gt;template( &#039;list\/event\/category&#039;, &#x5B; &#039;event&#039; =&gt; $event ] ); ?&gt;\n\t\t\t\t&lt;\/header&gt;\n\n\t\t\t\t&lt;?php $this-&gt;template( &#039;list\/event\/description&#039;, &#x5B; &#039;event&#039; =&gt; $event ] ); ?&gt;\n\t\t\t\t&lt;?php $this-&gt;template( &#039;list\/event\/cost&#039;, &#x5B; &#039;event&#039; =&gt; $event ] ); ?&gt;\n\n\t\t\t&lt;\/div&gt;\n\t\t&lt;\/article&gt;\n\t&lt;\/div&gt;\n\n&lt;\/div&gt;\n<\/pre><\/div>\n\n\n<p>If you compare the above code with the original code, you&#8217;ll notice the following changes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The addition of <code>$the_event_id = \\TEC\\Events\\Custom_Tables\\V1\\Models\\Occurrence::normalize_id ($event-&gt;ID);<\/code> code.\n<ul class=\"wp-block-list\">\n<li>This code is responsible for converting the Provisional ID to the WordPress Post ID as explained earlier.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>The addition of the <code>if (tribe_event_in_category ('generated', $the_event_id))<\/code> conditional.\n<ul class=\"wp-block-list\">\n<li>This conditional simply means that we only show the event&#8217;s featured image if the event to be listed in list view is in the <em>generated<\/em> (category slug).<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>The above use case opens up a range of other possibilities, so please feel free to adjust your code accordingly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In The Events Calendar, especially when working with recurring events or the custom tables system, you may encounter an ID that looks like a Post ID but is much larger (e.g., 10000114). This is a provisional ID, and it refers to a specific occurrence of an event, not the parent event post itself. This guide&#8230;<\/p>\n","protected":false},"author":63,"featured_media":1955565,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_swpsp_post_exclude":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"ep_exclude_from_search":false,"footnotes":""},"categories":[24,59,67],"tags":[],"stellar-product-taxonomy":[158,161],"class_list":["post-1966731","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-customizing","category-php-function-snippets","category-recurring-events","stellar-product-taxonomy-events-calendar-pro","stellar-product-taxonomy-the-events-calendar"],"acf":[],"taxonomy_info":{"category":[{"value":24,"label":"Customizations"},{"value":59,"label":"PHP Functions &amp; Snippets"},{"value":67,"label":"Recurring Events"}],"stellar-product-taxonomy":[{"value":158,"label":"Events Calendar Pro"},{"value":161,"label":"The Events Calendar"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"Tristan","author_link":"https:\/\/theeventscalendar.com\/knowledgebase\/author\/tristan\/"},"comment_info":0,"category_info":[{"term_id":24,"name":"Customizations","slug":"customizing","term_group":0,"term_taxonomy_id":24,"taxonomy":"category","description":"","parent":0,"count":91,"filter":"raw","term_order":"0","cat_ID":24,"category_count":91,"category_description":"","cat_name":"Customizations","category_nicename":"customizing","category_parent":0},{"term_id":59,"name":"PHP Functions &amp; Snippets","slug":"php-function-snippets","term_group":0,"term_taxonomy_id":59,"taxonomy":"category","description":"","parent":24,"count":78,"filter":"raw","term_order":"0","cat_ID":59,"category_count":78,"category_description":"","cat_name":"PHP Functions &amp; Snippets","category_nicename":"php-function-snippets","category_parent":24},{"term_id":67,"name":"Recurring Events","slug":"recurring-events","term_group":0,"term_taxonomy_id":67,"taxonomy":"category","description":"","parent":61,"count":7,"filter":"raw","term_order":"0","cat_ID":67,"category_count":7,"category_description":"","cat_name":"Recurring Events","category_nicename":"recurring-events","category_parent":61}],"tag_info":false,"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1966731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1966731"}],"version-history":[{"count":8,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1966731\/revisions"}],"predecessor-version":[{"id":1969202,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1966731\/revisions\/1969202"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media\/1955565"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1966731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1966731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1966731"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1966731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}