Breaking the link between form entry and post

By: Asher Jacobsberg | Asked: 04/25/2025
ForumsCategory: Code HelpBreaking the link between form entry and post
Asher Jacobsberg asked 4 weeks ago

I'm trying to improve the workflow of my website, and I thought I'd found a code snippet that would work, but it doesn't seem to be. I wonder if anyone can help me understand what I'm getting wrong.

This is what I would like to happen:

  1. User fills out a form.
  2. I check the uploaded information and approve it.
  3. Form actions create a draft post using some of the data from the form.
  4. The link between the form entry and the post is severed (by this code: https://formidableforms.com/knowledgebase/frm_after_create_entry/#sts=Break%20post%20content%20and%20View%20connection
  5. I can edit the post and publish it.
  6. The data in the form entry is not affected by the edits to the post (equally editing the form entry does not update the post).

The first 3 steps are working, and although I can edit the post and publish it what actually gets published is still what is in the form entry. If I update the form entry it updates the post. SO what seems to have happened is that the link between the form entry and the post is not severed, it has just become one-way, form->post.

Any ideas on what I should check?

  • I've updated the $form_ID to the ID of my form
  • I'm running the script through WPCode plugin as PHP on both the frontend and the admin area
1 Answers
Rob LeVineRob LeVine Staff answered 4 weeks ago

Did you verify that the code line to update the entry was run and returned a non-zero value? You can do it either by putting debug commands in your snippet or by looking at the database and seeing if the post_id column was cleared out.

Asher Jacobsberg replied 3 weeks ago

I'm not sure that I've got the debugging working correctly. It's showing some errors in the log (for other things, like translations loading at the wrong time), but nothing about what scripts are run when the entry is updated.
But it seems pretty clear that the script isn't working as after the entry in FF is updated, a field appears in the righthand sidebar of the edit entry page showing a link to the post. Presumably if the post was detached this would not be there.

Rob LeVineRob LeVine Staff replied 3 weeks ago

You're not looking for errors; rather, you're looking for whether the code is called and, if so, what happens inside the code. You can use the error_log command to output that information to the log file.

Rob LeVineRob LeVine Staff replied 3 weeks ago

Nice job on getting the details. I can't tell you if 5520 is the correct post id. I suggest you add the output of the entry ID to make sure it's what you think. Clearly, it has a post_id, so that's a good start. Then you'll have to look in the database at the post_meta table to see if there's an entry with both 5520 as its post_id and frm_display_id as its meta_key. It's kind of impossible for it to fail if that combination exists. In conclusion, verify that the entry ID and post ID are correct and that the aforementioned combination does exist.

Rob LeVineRob LeVine Staff replied 3 weeks ago

Great, now your entry is gone from the post. This forum software is starting to drive me nuts.

Asher Jacobsberg replied 3 weeks ago

Yes, sorry. It's me. It keeps messing up the formatting so I've deleted it a couple of time trying to sort it out. I just tried to upload the script, but that's not working either.

Asher Jacobsberg replied 3 weeks ago

Thanks for all your help with this Rob - and for bearing with me while I get frustrated with this forum software!

Rob LeVineRob LeVine Staff replied 3 weeks ago

Just make sure you see my comment in response to your missing comment. For code, I suggest always using a code pasting site such as pastebin and add a link to your paste rather than the code.

Asher Jacobsberg replied 3 weeks ago

Right, I've got it to output the entry ID as well, like this:
error_log( "Failed to delete meta for post ID: {$entry->post_id} - Entry ID: {$entry_id}" );

And they are clearly different:

[29-Apr-2025 15:16:50 UTC] Failed to delete meta for post ID: 5521 - Entry ID: 2288

Rob LeVineRob LeVine Staff replied 3 weeks ago

Different is good, but it doesn't really help. The questions are A) whether that entry id and post id are the same as what you're looking at in the UI and B) whether the entry post_id/'frm_display_id' meta key combination exists in the database. If it does, then the question is why it won't delete it. If it doesn't exist then it has to be that the entry id and post id are not what you think they are are. If it does exist, the only thing I can think of, and I don't even know if it's possible, that the user deleting doesn't have permission to do that. One thing I can say for sure is that when you figure it out, you'll say "ohhhhh".

Asher Jacobsberg replied 3 weeks ago

It looks to me like the only entry in postmeta with post_id 5520 does not have frm_display_id as its meta_key
https://1drv.ms/i/c/09e7aa2a77d9816e/ETjmsDbWmo1MmUeE_PLPNcgBr4Aj8ExR3l-k9qrw8hRvCw?e=4HeS2J

Asher Jacobsberg replied 3 weeks ago

Checking the UI, Entry ID displayed in FF is 2288 and the post it links to has the WP ID 5521
For Entry ID 2287, the Post ID is 5520.
So it seems that the values being returned in the UI and in the script are the same.

Rob LeVineRob LeVine Staff replied 3 weeks ago

Well, that explains why the delete isn't doing anything. I'm back to my theory that the entry you're looking at in Formidable is not what you think it is. I suggest searching the same table for ANY post_id that has "frm_display_id" as a meta value and reverse engineering it back to what your looking at in the front end. You can always file a support request with Strategy11 or hire a developer to look at it. https://formidable-masterminds.com/developers-directory/ I guess it's also possible the snippet is outdated and that's not how it works anymore.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right