I have a list of posts.
When I click on a post, I want a modal window to appear, containing three fields from that post.
The thing is, I don’t know how to get the post ID that I clicked on into the PHP code to tell it where to get those fields from.
Can anyone help?
Wordpress has a built-in function to determine the post ID from a given URL : url_to_postid( string $url );
It will return the post ID or 0 on failure.
2) Then you could use the wordpress function to get the post ID and your acf values.
3) Finally, you launch your modal if you get all your needed datas.
Let me know if it helps,