I have a plugin that I’m working on and I’m having trouble getting the post id so jquery can use it. I’m able to get it using the admin_head hook but I’m not sure how I can return it to jquery. I’m not sure if admin_head is what I need since it does not return anything. Not sure if I can use global?
Also this is in the admin screen so not on the front end.
Here is what I have so far:
Is there a function that I could call from jquery that would be able to return the id from a hook or does someone know of a better way?
Using your code you could something like this:
And then just use the var
js_post_id. You shoudl try to read about the script localization function and use it.