Problem: I have set up a custom form where my site users can select multiple posts. When the form is submitted, the page URL is updated to include those selected post IDs in a repeating URL parameter post_ids. I have custom code in place that triggers a cred_save_data hook when this page loads, and the code grabs post_ids from the URL parameter to update those posts. Multiple post IDs are added to the URL successfully, but only one post is actually updated by the cred_save_data hook.
Solution: To access URL parameters in a cred_save_data hook, find them in $_GET instead of $_POST:
$url_params = $_GET['post_ids'];
Also be sure to use the square bracket notation to indicate multiple values are included:
https://yoursite.com/delegate-update-results/?post_ids[]=44175&post_ids[]=44163&post_ids[]=44162
Then you must update your code to work with an array of values instead of a comma-separated string.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 2 respuestas, has 2 mensajes.
Last updated by mikeB-14 hace 4 años, 3 meses.
Assisted by: Christian Cox.