Make WordPress Core

Opened 15 years ago

Closed 11 years ago

#3700 closed defect (bug) (duplicate)

Adding a custom field to an unsaved Page before publishing causes weirdness

Reported by: markjaquith Owned by: Andy
Milestone: Priority: normal
Severity: normal Version: 2.3.2
Component: Editor Keywords:
Focuses: Cc:

Description (last modified by markjaquith)

As reported on my blog by "Kira":

  1. I start a new page and give it a title of “Forum” without the quotes, leaving the page content blank;
  2. I add a links_to custom field with a value of “http://www.kalunite.net/forum/” without the quotes;
  3. Click “Publish”;

The newly created page is not listed among the Pages; instead, it is saved as a post draft by WordPress. Furthermore, the title is “Draft created on January 27, 2007 at 10:51 am” instead of “Forum”.

More generically:

  1. Click "Write > Page"
  2. Move quickly for the next few steps
  3. Add a title (optional: content)
  4. Add a custom field key/value pair (click "Add Custom Field" after typing it in)
  5. Click "Publish"

What happens is that adding the custom field creates the Page as a POST draft, with a "Draft created on DATE at TIME" title. You have to move quickly because autosave appears to rectify this. clicking Publish does nothing, and your page seems to disappear (it has become a page draft).

Bit of an edge case, but still a valid bug.

Attachments (2)

add_meta_post_type.diff (2.3 KB) - added by markjaquith 15 years ago.
wp-screenshot.png (52.8 KB) - added by ranchnachos 11 years ago.

Download all attachments as: .zip

Change History (21)

#1 @markjaquith
15 years ago

  • Description modified (diff)

Note: you must click "Add Custom Field" after filling in the custom field info

#2 @markjaquith
15 years ago

  • Owner changed from anonymous to Andy
  • Version set to 2.1

Okay, add_meta_post_type.diff helps passes along the post_type with the meta-add AJAX action and puts that into the post_type when creating the temporary post...

BUT... nothing happens when clicking Publish (i.e. it is left as a Page Draft with the draft title), so something else is missing.

Andy, Mike A... help!

#3 @charleshooper
15 years ago

I tested your patch using 2.2-bleeding and the default theme. It works fine for me, didn't see any JS errors thrown up or anything either.

#4 @markjaquith
15 years ago

Yes, but it doesn't quite fix the problem. The page isn't published, and its contents aren't saved. All it does is prevent it from turning into a POST draft.

#5 @Nazgul
15 years ago

  • Milestone changed from 2.1.1 to 2.1.2

#6 @foolswisdom
15 years ago

  • Milestone changed from 2.1.3 to 2.3

#7 in reply to: ↑ description @doodlebee
14 years ago

  • Version changed from 2.1 to 2.1.3

I would like to say that I have this same bug appearing on my site. I'm running 2.1.3. I'll run through my steps:

1) Write Page
2) Enter title
3) enter content
4) uncheck "allow comments" and "allow pings"
5) set "Page status" to "Published"
6) scroll down, add custom field (whether or not I've already created it, I enter the values here)
7) click "Apply Custom Field"
8) scroll back up, hit "Publish"
9) the new Page does NOT appear in the "Pages" list. Instead, it shows up in the "Posts" list. Shows up as "Unpublished", title is changed to "Draft created on [date] at [time]"

Now, if I create the Page *without* a custom value, I have no problem. It'll save as a Page, and then I can go back in and add the custom field and everything is fine. But it sure adds some unnecessary steps.

#8 @Nazgul
14 years ago

Also reported in #4250

#9 @Nazgul
14 years ago

  • Keywords needs-patch added
  • Milestone changed from 2.3 to 2.4

#10 @foolswisdom
14 years ago

Also reported in #5323

#11 @lloydbudd
14 years ago

Also reported in #5333 .

#12 @doodlebee
14 years ago

  • Version changed from 2.1.3 to 2.3.2

I'd like to add this to posts now. I'm running WordPress 2.3.2, and have a custom fields system set up for a client. Our system is:

1) types in post title, post content, selects category
2) scrolls down and adds custom field information, hits "Add Custom Field". Nothing happens, but apparently the field is added (I'm used to seeing it show up somewhere when you add it - but it never does.)
3) Publish post.

what I *expect* is to the post is published. What happens is the post is saved as "Draft created on (whatever date) at (whatever time)" - all post data entered is lost.

As with the rest 0if I write the post and publish, then return to it and add the custom field, it's fine. Annoying to have to do this every time, though.

#13 @guillep2k
13 years ago

  • Cc guillep2k added

This bug looks related to #6457.

#14 @felipelavinz
13 years ago

  • Cc guillep2k removed

Custom fields cause "publishing weirdness" on Pages even if you don't move quickly (as initially reported on this bug)... I've been working with Pages and custom fields on 2.5.1 and even with the trunk svn checkout, and everytime I try to add a custom field to a page I'm redirected to some other place... if, in fact, I go really quickly, before the auto-saving acts, clicking on "Add Custom Field" takes me to Write > Page, but none of the info I just entered it's there and I can't find that page anywhere... if I go slow and the page it's auto-saved before I add the new custom field, I get to Write > Page again, not to the Page I was editing, so I have to go to Manage > Pages and try to find it... The only "solution" I've found it's to write the info of the custom field and then, instead of clicking on "Add Custom Field", just click on "Save"... this, at least, works, but it feels totally primitive without the AJAX fireworks.

Maybe this should have a higher priority/severity level, since it leads to unpleasant loss of work... just my opinion

#15 @guillep2k
13 years ago

  • Cc guillep2k added

#16 @Denis-de-Bernardy
12 years ago

  • Component changed from Administration to Editor
  • Keywords close added

has been rotting for quite a while

#17 @scribu
12 years ago

  • Keywords close removed
  • Resolution set to worksforme
  • Status changed from new to closed

Closing due to lack of traction.

#18 @ranchnachos
11 years ago

  • Keywords needs-patch removed
  • Milestone changed from 2.9 to 2.9.3
  • Priority changed from normal to low
  • Resolution worksforme deleted
  • Severity changed from normal to minor
  • Status changed from closed to reopened
  • Version changed from 2.3.2 to 2.9.2

reopening this, as of 2.9.2 the bug is still there. It's pretty much as markjaquith has laid out.

  1. Create new post
  2. Add a custom field with anything you like. (don't forget the to click the add custom field button)
  3. Click Publish

You don't need a title, or content or anything else.

It also seems Wordpress travels into the future to create a title for you.
I've attached a screenshot.

#19 @nacin
11 years ago

  • Milestone 2.9.3 deleted
  • Priority changed from low to normal
  • Resolution set to duplicate
  • Severity changed from minor to normal
  • Status changed from reopened to closed
  • Version changed from 2.9.2 to 2.3.2

Duplicate of #11889 and #13401.

Note: See TracTickets for help on using tickets.