Skip Navigation

Access relationships after submitting a form no longer works

Resolved

Reported for: Toolset Forms 2.0

Resolved in: 2.2

Symptoms

Before Forms 2.0, you could get the ID of the parent of a post by getting the postmeta value where it was stored:
$parent_id = get_post_meta($post_id, '_wpcf_belongs_{parent_post_type_slug}_id', true);

After 2.0, and once your site updates to Types 3.0, this mechanism still works for migrated relationships.

However, there was a glitch that broke that compatibility layer when used in the hooks that Forms executes after submitting a form, like cred_save_data and cred_submit_complete.

Workaround

A solution for this issue will be included in the next version of Toolset Forms.

Until then, please apply the following workaround:

  • First, make sure that you are using the cred_submit_complete hook. For relationships in the Types 3.0 era, cred_save_data runs too early and relationships have not been saved yet, so you can not get their data.
  • Second, download, unzip and upload the file contained in this patch, to replace the one with the same name located in /vendor/toolset/toolset-common/inc/autoloaded/postmeta_access/, inside your Toolset Forms installation, and inside the instalation of any other Toolset plugin that you might be using, like Types, Views, Layouts or Access.

Comments are closed