Support

Account

Home Forums Front-end Issues Create Post if it doesn't exist in relationship field Reply To: Create Post if it doesn't exist in relationship field

  • Since the relationship field does an admin Ajax call to query for a post to relate to, is there a way programmatically add to the returned results or is there a way for me to create a new post and then set the relationship field to the new result?

    Example:
    Two forms on one page. Form A has the relationship field and makes post type 1. Form B has a form that creates a new post type 2 via Ajax so the page doesn’t reload. When a new post type 2 is created by form 2 I want to then set the relationship field in form A to this newly created post type 2 without user action.

    I would need to simulate searching and setting the relationship after its created without the user actually doing so.