Home Forums General Issues How to pass values from post to another page


How to pass values from post to another page

  • I have several courses (custom post type) and one subscribe page containing a gravity form. What I try to achieve is passing the ACF values of a single course to the subscribe page, so that I can populate gravity fields with the ACF values of that particular course.

    This can be achieved by putting the course ID in a code snippet, see However the problem is that I have a lot of courses. So I would really like the post id and corresponding custom field values to be passed dynamically.

    I read something about passing the course ID to the url of the subscribe page, like and then retrieving the data of the course with ID=1.

    1. How to put the course ID in the url of the subscribe page?
    2. How to retrieve the course data and custom field values belonging to that course ID?

    Anyone can help me out? Total noob. Code snippet would be appreciated.

  • You need to find where the link to the subscribe is generated in your template file and modify it to add the url query parameter for the course that is being shown.

    If you post code of where this link is added someone may be able to help you modify it.

  • There are two ways to pass variables between web pages. The first method is to use sessionStorage, or localStorage. The second method is to use a query string with the URL.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.