Answers.Body: <p>I had this problem intermittently for some time when embedding event registration forms using a Wordpress shortcode. It has to do with page caching. CiviCRM parses the shortcode to capture the event ID and adds the id value to the global $_GET object. If the page is loaded from cache (usually when the back/forward button is pressed) the code that parses the shortcode does not run, and the event ID is not added to $_GET.</p>
  <p>I was able to fix this issue by making a page cache exception with the caching plugin I'm using.</p>
  <p>I think this behavior is essentially a bug and CiviCRM should output a hidden form variable with the event ID so that it still gets passed to the &quot;Thank You&quot; page if the registration form is loaded from cache.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-13T19:34:20.973Z
Answers.LastActivityDate: 2021-10-13T19:40:04.613Z
Answers.LastEditDate: 2021-10-13T19:40:04.613Z
Answers.UserDisplayName: dsmith63
Answers.Body: <p>I'm getting the same for when participants confirm the registration to an event. Bug stack:</p>
  <pre><code>CRM_Core_Exception: Could not find valid value for id in /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Event/StateMachine/Registration.php on line 27
  
  0   CRM_Utils_Request::retrieve('id', 'Positive', Object(CRM_Event_Controller_Registration), true)  /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Event/StateMachine/Registration.php:27
  1   CRM_Event_StateMachine_Registration-&gt;__construct(Object(CRM_Event_Controller_Registration), true)   /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Event/Controller/Registration.php:27
  2   CRM_Event_Controller_Registration-&gt;__construct('Event Registrati…', true, 'null', null, 'false')    /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:314
  3   CRM_Core_Invoke::runItem(Array) /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69
  4   CRM_Core_Invoke::_invoke(Array) /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36
  5   CRM_Core_Invoke::invoke(Array)  /var/www/wordpress/wp-content/plugins/civicrm/civicrm.php:1199
  6   CiviCRM_For_WordPress-&gt;invoke() /var/www/wordpress/wp-content/plugins/civicrm/includes/civicrm.basepage.php:380
  7   CiviCRM_For_WordPress_Basepage-&gt;basepage_handler(Object(WP))    /var/www/wordpress/wp-includes/class-wp-hook.php:307
  8   WP_Hook-&gt;apply_filters(null, Array) /var/www/wordpress/wp-includes/class-wp-hook.php:331
  9   WP_Hook-&gt;do_action(Array)   /var/www/wordpress/wp-includes/plugin.php:522
  10  do_action_ref_array('wp', Array)    /var/www/wordpress/wp-includes/class-wp.php:771
  11  WP-&gt;main('')    /var/www/wordpress/wp-includes/functions.php:1310
  12  wp()    /var/www/wordpress/wp-blog-header.php:16
  13  require('/var/www/wordpre…')    /var/www/wordpress/index.php:17
  14  {main}
  </code></pre>
  <p>And the error that the users see is <code>Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.</code>
  <code>Could not find valid value for id</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-25T14:37:20.310Z
Answers.Text: Steve - this isn't an answer to the question. It could go as a comment to the question, but given how old the question is and that you are likely tobe using different versions of  CiviCRM and WordPress and there wasn't enough info in the original question, I would delete this and start again.
Answers.UserDisplayName: Mick Kahn
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-25T21:38:23.617Z
Answers.Text: could be Steve's lack of reputation. Steve, you did same on another ticket. Best to create some new tickets and reference the old ones. that will get you some more points so you should then be able to Comment
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-26T11:40:44.383Z
Answers.Text: Got it, thank you. I'm not sure how StackExchange works. I'll start a new ticket.
Answers.UserDisplayName: Steve
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-25T11:50:09.283Z
Answers.LastActivityDate: 2022-03-25T11:50:09.283Z
Answers.UserDisplayName: Steve
Body: <p>On my civievent, people get the error message " could not find valid value for id" on wordpress 4.8.1</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-01T23:34:14.953Z
Comments.Text: I'd like to help you, but I'll need some more information. What are the specific steps that led to this error? Viewing the event page? Registering for the event? Can you provide a screenshot? Does *everyone* get the error? Are you able to reproduce it consistently? Can you post a link to the event page so others can look at it? What *is* working? Other events? Are the any recent changes you're aware of that could help us diagnose the problem?
Comments.UserDisplayName: Sean
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-02T16:08:36.037Z
Comments.Text: In addition to Sean's questions - the most helpful info you can give is the debugging info. In CiviCRM, go to **Administer menu > System Settings > Debugging and Error Handling**, select "Yes" to both "Enable Debugging" and "Display Backtrace", and press "Save". Repeat the steps that caused your error, and you'll see much a more detailed error. Please update this question with the expanded error and backtrace - and don't forget to disable debug/backtrace when you're done!
Comments.UserDisplayName: Jon G - Megaphone Tech
Tags: <wordpress><error>
Title: "could not find valid value for id" on wordpress 4.8.1
ThreadText: # "could not find valid value for id" on wordpress 4.8.1
  
  (Asked by: username_0 on 2017-09-01)
  
  On my civievent, people get the error message " could not find valid value for id" on wordpress 4.8.1
  
  **Tags:** wordpress, error
  
  > **Comments:**
  > **username_1**: I'd like to help you, but I'll need some more information. What are the specific steps that led to this error? Viewing the event page? Registering for the event? Can you provide a screenshot? Does *everyone* get the error? Are you able to reproduce it consistently? Can you post a link to the event page so others can look at it? What *is* working? Other events? Are the any recent changes you're aware of that could help us diagnose the problem?  
  > **username_2**: In addition to username_1's questions - the most helpful info you can give is the debugging info. In CiviCRM, go to **Administer menu > System Settings > Debugging and Error Handling**, select "Yes" to both "Enable Debugging" and "Display Backtrace", and press "Save". Repeat the steps that caused your error, and you'll see much a more detailed error. Please update this question with the expanded error and backtrace - and don't forget to disable debug/backtrace when you're done!  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2021-10-13. Score: 1
  
  I had this problem intermittently for some time when embedding event registration forms using a Wordpress shortcode. It has to do with page caching. CiviCRM parses the shortcode to capture the event ID and adds the id value to the global $\_GET object. If the page is loaded from cache (usually when the back/forward button is pressed) the code that parses the shortcode does not run, and the event ID is not added to $\_GET.
  
  I was able to fix this issue by making a page cache exception with the caching plugin I'm using.
  
  I think this behavior is essentially a bug and CiviCRM should output a hidden form variable with the event ID so that it still gets passed to the "Thank You" page if the registration form is loaded from cache.
  
  
  ---
  
  ### Answer by username_4 on 2022-03-25. Score: 0
  
  I'm getting the same for when participants confirm the registration to an event. Bug stack:
  
  ```
  CRM_Core_Exception: Could not find valid value for id in /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Event/StateMachine/Registration.php on line 27
  
  0   CRM_Utils_Request::retrieve('id', 'Positive', Object(CRM_Event_Controller_Registration), true)  /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Event/StateMachine/Registration.php:27
  1   CRM_Event_StateMachine_Registration->__construct(Object(CRM_Event_Controller_Registration), true)   /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Event/Controller/Registration.php:27
  2   CRM_Event_Controller_Registration->__construct('Event Registrati…', true, 'null', null, 'false')    /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:314
  3   CRM_Core_Invoke::runItem(Array) /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69
  4   CRM_Core_Invoke::_invoke(Array) /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36
  5   CRM_Core_Invoke::invoke(Array)  /var/www/wordpress/wp-content/plugins/civicrm/civicrm.php:1199
  6   CiviCRM_For_WordPress->invoke() /var/www/wordpress/wp-content/plugins/civicrm/includes/civicrm.basepage.php:380
  7   CiviCRM_For_WordPress_Basepage->basepage_handler(Object(WP))    /var/www/wordpress/wp-includes/class-wp-hook.php:307
  8   WP_Hook->apply_filters(null, Array) /var/www/wordpress/wp-includes/class-wp-hook.php:331
  9   WP_Hook->do_action(Array)   /var/www/wordpress/wp-includes/plugin.php:522
  10  do_action_ref_array('wp', Array)    /var/www/wordpress/wp-includes/class-wp.php:771
  11  WP->main('')    /var/www/wordpress/wp-includes/functions.php:1310
  12  wp()    /var/www/wordpress/wp-blog-header.php:16
  13  require('/var/www/wordpre…')    /var/www/wordpress/index.php:17
  14  {main}
  
  ```
  
  And the error that the users see is `Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.`
  `Could not find valid value for id`
  
  > **Comments:**
  > **username_5**: username_4 - this isn't an answer to the question. It could go as a comment to the question, but given how old the question is and that you are likely tobe using different versions of  CiviCRM and WordPress and there wasn't enough info in the original question, I would delete this and start again.  
  > **username_6**: could be username_4's lack of reputation. username_4, you did same on another ticket. Best to create some new tickets and reference the old ones. that will get you some more points so you should then be able to Comment  
  > **username_4**: Got it, thank you. I'm not sure how StackExchange works. I'll start a new ticket.  
  
  ---
  
  