Compatibility with post revisions
-
Hi all.
I have a custom post type ‘location’. I am creating a system so that when a new location is created, a post of type ‘office’ is created with some post meta corresponding to the location post’s data.
Here is my code: https://pastebin.com/D27KLFM2
(I am fairly new at PHP…so if you find some faults beside those mentioned in this post feel free to inform me).The code currently updates the post meta of the new office ‘wpcf-location-list’ with the post ID of a revision of the new location, instead of the final location post’s ID. The desired result of this function is to have the post meta of the newly created office be set to the final ID of the new location.
I assigned the $locID to get the $post_id in case the post ID was being changed somewhere before that line, before I realized it was a revision that was causing the problem.
What can I do to make my function compatible with WP’s revision system?
Again, the desired result of this function is to have the post meta of the newly created office be set to the final ID of the new location.Thanks ahead for any input!
- The topic ‘Compatibility with post revisions’ is closed to new replies.