Replies: 4 comments
-
As far as I can tell, $is_new_item gets defined based on whether an ID exists for the post object yet. However, WordPress starts auto-saving the post as soon as the title or any content is entered, which creates an initial database entry. I'm seeing similar behavior on the Not sure if it's a solution for you, but I wouldn't rely on |
Beta Was this translation helpful? Give feedback.
-
Thanks. That is pretty much the conclusion I had come to and the work around I am using. It just seems...inelegant. And since $is_new_item is used in Pods documentation, I don't think this is how the developers are intending for it to work. |
Beta Was this translation helpful? Give feedback.
-
We have some code that tries to help with this. I wish it was more elegant so I think we can try to revisit this again. |
Beta Was this translation helpful? Give feedback.
-
I still encounter this issue, up to this date. Shouldn't the development team hide this parameter, until it is resolved? I've perplexed by this parameter's abnormal behaviour until I saw this post. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using pods_api_pre_save_pod_item_field_event to run some code when a new entry is made for one of my custom pods, field_event, but I am sometimes getting an un-expected value for the $is_new_item parameter.
If I run this code:
pods_api_pre_save_pod_item_field_event fires twice, once after the first line, at which point $is_new_item is true, and once after the last line, at which point $is_new_item is false. This is what I would expect.
If I modify an existing Field Event manually, pods_api_pre_save_pod_item_field_event fires after I hit the "Update" button, and $is_new_item is false, as I would expect.
If, however, I add a new Field Event using the "Add New" button on the Field Events page, pods_api_pre_save_pod_item_field_event does not fire immediately, but only after I hit the "Publish" button, at which point I would expect $is_new_item to be true, but it is false.
Is this a bug, or am I missing something about how this should be working?
I am testing this on my local machine using WordPress 5.7.2 and Pods 2.7.27.
ETA: In case it helps, here is the code that uses the filter:
Beta Was this translation helpful? Give feedback.
All reactions