{"id":1299649,"date":"2017-06-17T10:14:57","date_gmt":"2017-06-17T17:14:57","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/"},"modified":"2017-06-17T10:14:57","modified_gmt":"2017-06-17T17:14:57","slug":"getting-error-undefined-variable-postid","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/","title":{"rendered":"Getting error Undefined variable: postId"},"content":{"rendered":"<p>Hello!  I&#8217;ve recently started getting errors on my website homepage, where it goes down off and on for the past few days. When the page is down, I get the error:<\/p>\n<blockquote><p>This page isn\u2019t working<br \/>\nvalleyfirstaidtraining.ca redirected you too many times.<br \/>\nTry clearing your cookies.<br \/>\nERR_TOO_MANY_REDIRECTS<\/p><\/blockquote>\n<p>So I created a duplicate copy of the site under https:\/\/valleyfirstaidtraining.ca\/test_site\/ and I updated all plugins there. Because of the too many redirects, I thought to include wp_reset_postdata(); to my two custom queries (Upcoming Events, and getting Events by Location), and it loaded the page, but with errors:<\/p>\n<blockquote><p>Notice: Undefined variable: postId in \/home\/valleyfi\/public_html\/test_site\/wp-content\/themes\/valleyfirstaid\/sidebar-home.php on line 31<\/p><\/blockquote>\n<p>That refers to the code snippets:<\/p>\n<pre><code>&lt;?php query_posts(array( &#039;post_type&#039; =&gt; &#039;tribe_events&#039;, &#039;posts_per_page&#039; =&gt; 5 ) ); \n                while (have_posts()) : the_post(); $url = esc_url( get_permalink( tribe_get_venue_id( $postId ))); ?&gt;\n                    &lt;h3&gt;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;\/a&gt;&lt;\/h3&gt;\n                    &lt;p&gt;&lt;?php echo tribe_get_start_date($post-&gt;ID, true, $format = &#039;F j, Y - l&#039; );?&gt;&lt;br&gt;\n                    &lt;?php echo tribe_get_venue_link()?&gt;&lt;\/p&gt;   \n                &lt;?php endwhile; wp_reset_postdata(); ?&gt;<\/code><\/pre>\n<p>and<\/p>\n<pre><code>&lt;?php query_posts(array( &#039;post_type&#039; =&gt; &#039;tribe_venue &#039; ) ); \n                while (have_posts()) : the_post();\n                $url = esc_url( get_permalink( tribe_get_venue_id( $postId ))); ?&gt;\n                    &lt;h3&gt;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;\/a&gt;&lt;\/h3&gt;\n                    &lt;p&gt;&lt;?php echo tribe_get_address(). &#039;,&lt;br&gt;&#039;. tribe_get_city() .&#039;, &#039;. tribe_get_stateprovince() .&#039; &#039;. tribe_get_zip() .&#039; &#039;. tribe_get_country(); ?&gt;&lt;br&gt;\n                    &lt;a href=&quot;&lt;?php echo $url; ?&gt;#tribe-events-content&quot;&gt;View Courses &lt;i class=&quot;fa fa-arrow-circle-right&quot;&gt;&lt;\/i&gt;&lt;\/a&gt;&lt;\/p&gt;   \n                &lt;?php endwhile; wp_reset_postdata(); ?&gt;<\/code><\/pre>\n<p>Are parts of this snippet deprecated? Why is $postID an undefined variable?<br \/>\nThanks!<\/p>\n","protected":false},"template":"","class_list":["post-1299649","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Getting error Undefined variable: postId -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting error Undefined variable: postId -\" \/>\n<meta property=\"og:description\" content=\"Hello! I&#8217;ve recently started getting errors on my website homepage, where it goes down off and on for the past few days. When the page is down, I get the error: This page isn\u2019t working valleyfirstaidtraining.ca redirected you too many times. Try clearing your cookies. ERR_TOO_MANY_REDIRECTS So I created a duplicate copy of the site [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/\",\"name\":\"Getting error Undefined variable: postId -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2017-06-17T17:14:57+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Community Events\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/community-events\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Getting error Undefined variable: postId\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Getting error Undefined variable: postId -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/","og_locale":"en_US","og_type":"article","og_title":"Getting error Undefined variable: postId -","og_description":"Hello! I&#8217;ve recently started getting errors on my website homepage, where it goes down off and on for the past few days. When the page is down, I get the error: This page isn\u2019t working valleyfirstaidtraining.ca redirected you too many times. Try clearing your cookies. ERR_TOO_MANY_REDIRECTS So I created a duplicate copy of the site [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/","name":"Getting error Undefined variable: postId -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2017-06-17T17:14:57+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/getting-error-undefined-variable-postid\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Community Events","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/community-events\/"},{"@type":"ListItem","position":5,"name":"Getting error Undefined variable: postId"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1299649","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1299649\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1299649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}