[Résolu] Code snippet to get the Post ID of a parent post via child Post Reference field?
This support ticket is created Il y a 3 années et 9 mois. There's a good chance that you are reading advice that it now obsolete.
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.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
One Client may own many vehicles.
The Vehicle table includes a POST REFERENCE FIELD which references the post title of the Client post.
How can I write a code snippet that retrieves the Post ID of the parent post?
When the vehicle post is saved, I want to save that value into a custom field of the Vehicle post.
Hello. Thank you for contacting the Toolset support.
You mean, when you save the vehicle post from the backend admin?
Can you please share test vehicle post link and temporary admin access details so I can review how exactly you setup the things and share the solution with you.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I see that I do not able to add the PHP snippet using the "Custom Code" section </offered by Toolset.
It shows following notice:
Unfortunately, this snippet cannot be edited directly. Check file permissions and wp-config.php constants DISALLOW_FILE_EDIT and DISALLOW_FILE_MODS. Alternatively, you can edit the file manually.
Can you please send me FTP access details so that I can add the required code.
The thing is that I still require to build the solution and test it and then I'll send you working solution but I will require place where I can add and test solution.
That is why I'll require temporary access to FTP or you can revoke file edit restrictions.
I have set the next reply to private which means only you and I have access to it.