
In subdirectory WP installations, VFB forms return an Invalid Form ID error and fail to record the donation in the backend.
User identified this as a URL construction issue for missing a / at the end of the home_url(). Line they’re referring to: [https://github.com/impress-org/givewp/blob/develop/src/Framework/Routes/Router.php#L136|https://github.com/impress-org/givewp/blob/develop/src/Framework/Routes/Router.php#L136|smart-link]
Jon’s suggested solution: Use [https://developer.wordpress.org/reference/functions/trailingslashit/|https://developer.wordpress.org/reference/functions/trailingslashit/|smart-link]
-
Robin Joshua Del Mundo Apr 9th at 3:05 PM
I managed to test this solution on a test site in a subdirectory installation, and it looks to be a quick solution as we only need to edit one line. So far, I don’t see any kind of ramifications.
Steps to replicate:
Changing this line [https://github.com/impress-org/givewp/blob/develop/src/Framework/Routes/Router.php#L136|https://github.com/impress-org/givewp/blob/develop/src/Framework/Routes/Router.php#L136|smart-link] , from home_url() _to_ rtrim(home_url(), '/').'/' resolves the issue.
-
Reference
(Migrated from featureOS: https://givewp.featureos.app/p/sites-in-a-subdirectory-produce-an-error-when-donating-via-vfb-forms)
Adrian Sylvie via Priority Support
Coding Free Support via Priority Support
Hieu via Free Support
Tarun Patel via Priority Support
Anthony Briggs via Priority Support
Miami Beach United via Priority Support
Gordon Wilson via Priority Support
Adam Allnutt via Priority Forms
krulldna via Free Support
johannsf via Free Support
David Benner via Priority Support
davebenner14 via Free Support
انا لاأجد نموذج التبرع الذى انشأته ووضعت موقعى عليه
I can’t find the donation form I created and put my site on.
dereje2 via Free Support