WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#6343 closed defect (bug) (fixed)

Adding custom field: wording and behaviour

Reported by: versuchsanstalt Owned by: mdawaffe
Milestone: 2.5 Priority: normal
Severity: normal Version: 2.5
Component: Administration Keywords: AJAX has-patch needs-testing
Focuses: Cc:

Description

Adding custom fields has changed with 2.5rc1.

It seems impossible now to add more than one custom field before saving the post.

Clicking "Add Custom Field" does NOT (only) what the button says, but will also save the post. Either the wording is wrong or the behaviour.

Please bring back the 2.3.3 behaviour. I am developing a site where every post is just one or two sentences and two, sometimes three custom fields. It used to take about 20-30 seconds to write a post using 2.3.3, now its turning into a clickfest.

One or two more form elements for adding custom fields would also solve my problem, but the old way to do it used to be far better than that. I am considering to stay with 2.3.3.

Attachments (2)

6343.diff (9.0 KB) - added by mdawaffe 7 years ago.
6343.2.diff (551 bytes) - added by DD32 7 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 @ryan7 years ago

  • Keywords AJAX added
  • Milestone changed from 2.7 to 2.5
  • Owner changed from anonymous to mdawaffe

Looks like the Add Custom Field AJAX is busted.

comment:2 @mdawaffe7 years ago

  • Status changed from new to assigned

I'll have a patch for this by Saturday afternoon PST.

@mdawaffe7 years ago

comment:3 @mdawaffe7 years ago

  • Keywords has-patch needs-testing added

6343.diff

  1. Fixes custom field add/update/delete.
  2. Uses autosave functions after adding a custom field to a never-before-saved post to update post id.
  3. Fixes strange wp-lists animation bug.
    jQuery( ... ).stop(); // doesn't work
    jQuery( ... ).stop().stop(); // does
    

comment:4 @ryan7 years ago

Working well here. I notice that after adding a meta key to a new post, if you add title text and then change focus to another field the autosave on title blur doesn't kick in. Not a big deal.

comment:5 @ryan7 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [7468]) Fix custom field add/update/delete. Props mdawaffe. fixes #6343

comment:6 @DD327 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Adding new meta keys when no meta keys currently exist is broken after the commit.

Upon clicking add, I get several PHP errors, To me, it looks like its not taking the correct branch.

Heres the post data:

array
  '_ajax_nonce' => string '92ea72e0e5' (length=10)
  'action' => string 'add-meta' (length=8)
  'post_id' => string '136' (length=3)
  'metakeyinput' => string 'testkey' (length=7)
  'metavalue' => string 'testvalue' (length=9)

I'll attach a patch for what seems to be the correct behaviour & is working for me

@DD327 years ago

comment:7 @ryan7 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [7509]) Fix addition of new meta keys when no meta keys currently exist. Props DD32. fixes #6343

Note: See TracTickets for help on using tickets.