Opened 15 years ago
Last modified 2 years ago
#11465 accepted defect (bug)
custom field duplicated
Reported by: | ericr23 | Owned by: | westi |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | minor | Version: | 2.8.4 |
Component: | Editor | Keywords: | needs-patch |
Focuses: | Cc: |
Description
When I enter the information for a custom field and click on Preview without first clicking Add Custom Field, the custom field is saved. But then when I click Publish, it is saved again, appearing in the post twice.
If I click Add Custom Field before Preview, subsequent Publish does not duplicate the custom field. But it is very convenient and efficient to be able to avoid a separate save of the custom field.
Attachments (4)
Change History (20)
#1
follow-up:
↓ 2
@
15 years ago
- Milestone changed from Unassigned to Future Release
- Severity changed from normal to minor
#2
in reply to:
↑ 1
@
15 years ago
- Milestone changed from Future Release to 2.9.1
- Version changed from 2.8.5 to 2.9
I was able to reproduce with 2.9:
- edit an existing post.
- enter text in the name and value textboxes under Custom Fields.
- press the Preview Changes button.
- close the newly opened browser tab.
- press the Publish button.
- post now has two times the same custom field.
I was not able to reproduce when javascript is deactivated.
I think the last information is important to drill down to the cause of the bug.
#4
@
15 years ago
- Milestone changed from 2.9.1 to 3.0
- Owner set to westi
- Status changed from new to accepted
- Version changed from 2.9 to 2.8.4
Tested in 2.8.4 and this bug exists there to.
Steps to reproduce:
- Create a new draft post.
- Enter a name and value but don't save the field
- Preview the post
- Publish the post
Moving to 3.0 as this is not a regression and there is currently know patch to fix the issue.
We should avoid these accidental duplicate custom fields but I don't think that this is a severe bug which needs fixing in a maintenance release.
#6
@
15 years ago
I can not say if that is the actual root cause, I assume something related to the workflow in the frontend javacript not reflecting a changed status in the persistent storage layer on the server-side.
But #10905 might prevent the duplicate add. But it won't prevent that the frontend tries to add again. Or is it the server side when I press publish. hmm.
=> First fix #10905
#7
@
15 years ago
Can still confirm against current trunk. Might not be javascript related but this must be a check performed on save draft / publish post. Tried an alternative test:
- Create a new draft post.
- Enter a name and value but don't save the field
- Preview the post
- Add additional text in the posts content
- Preview the post again
- Publish the post
That results in more additional fields. So not only the publish but the preview save-action needs to handle custom field duplicates properly, draft fields maybe?
The evolved suggestion in #10905 to extend the API functions might be really usefull to deal with this case.
#13
@
9 years ago
- Keywords needs-testing removed
I was able to confirm this bug (not every try though). I was not able to reproduce it at all after applying the patch. 11465.3.diff is a refresh from the src dir.
#14
@
9 years ago
11465.3.diff still applies. This is a simple change and fixes the issue.
#15
@
2 years ago
- Component changed from Options, Meta APIs to Editor
- Keywords needs-testing added
- Milestone set to 6.1
This can happen in 6.0 (beta 2), including with the block editor.
11465.3.diff seems to fix it.
#16
@
2 years ago
- Keywords needs-patch added; has-patch needs-testing removed
- Milestone changed from 6.1 to Future Release
Changing to update_post_meta()
overwrites values if you want multiple values for a key (see ticket:47576#comment:1), so this would need a different patch.
I guess you'll just have to click the "Add Custom Field" button before saving.