I have a requirement of saving meta data for CPT, the challenge is save data to the existing post if the same post title is already there and do not create a different post. so can you guide me that which hooks will trap these events and how to corealate wp hooks with metabox. eagerly waiting for your reply.
Hi Calpaq, how do you save posts? I mean do you run a code to save posts or use Meta Box plugins?
If you need to hook after Meta Box save post data, you can just use 'rwmb_after_save_post' hook, or save_post (with priority > 10). And then use update_post_meta to update meta data to an existing post of your choice.
Thanks for replying,
This is all relaated with wordpress admin
Let me tell you that I am not using any custom code to save posts and use meta box plugins. In my case I am using custom post type, so I have registered post type and by default its menu is added to wp admin so from there adding/updating/deleting posts. WordPress doesn't validate for post title and it can add same title with different Id. What I want is to validate post title ( i.e. check if post exists and if found retrieve that post and update that instead of creating new post with again same title ). I am using some metabox fields for this post type and now I want to check before insert that if any post exist. So actually I do not want create/insert any new post (if exist ), retrieve the ID and save these meta fields to that existing post, Can you help me in saving these fields with existing post when its already there.
Thanks & Regards