Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  Steve 2 months ago.

  • Author
    Posts
  • #9344

    Vineet Talwar
    Participant

    Hello,
    I need to prepare a form.
    Admins needs to enter post title, attach thumbnail image,
    select taxonomy. Based on selected taxonomy,
    I need to make a WP_Query and on submit, it attached the post ids returned from WP_Query to the post_meta.
    Following is my github gist for the form.
    https://gist.github.com/vineettalwar/855a93b45b16163b31bb54af0a2b8dc3
    I need to read selected taxonomy term id, then pass that term id to on_submit_query function (written at the end of the file.). it shall return post ids from that WP_Query and I need to simply update that id array to newly created post at a post meta key post_ids_key

    1) Could you please tell me how can I achieve that ?
    2) Every time a new post is created, is there any way it can be checked, if post exists then, update the post only in piklist.

  • #9410

    Vineet Talwar
    Participant

    Anyone ?

  • #9419

    Steve
    Keymaster

    I suggest you look at the piklist_save_fields hook, that should help you look at your field data before save.

    Using the standard WordPress filter wp_insert_post_data, will also help you look at data before it’s saved:
    https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_insert_post_data

You must be logged in to reply to this topic.