WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#13428 closed defect (bug) (worksforme)

"Post Type" field reverts to default on custom post types on updating post title

Reported by: goldenapples Owned by:
Milestone: Priority: low
Severity: normal Version: 3.0
Component: Posts, Post Types Keywords: reporter-feedback
Focuses: Cc:

Description

My working site has a number of posts which I wanted to test using custom post types. I added the register_post_type call to my theme functions.php file, creating two new custom post types - one with "hierarchical" set to true, the other without. I used phpmyadmin to assign some of my pages to the first category and some of my posts to the second (setting the 'post-type' field).

These posts/pages now show up on the correct UI screen on the dashboard. The "edit" links on the UI panel work properly, and I can edit content normally. Updating after changes to content also behaves as expected.

I have a problem changing the title or post slug and updating, though. Doing this seems to revert the post-type to the default ("post" or "page"), overwriting the custom post type I had set in phpmyadmin.

Updating the titles of posts created through the new ui works fine; I only see the problem when dealing with posts I've directly manipulated the post-type field in the database. Maybe this is not a problem, but I see this possibly being an issue for other people who want to maintain their existing content but categorize it in new custom post types.

Change History (12)

comment:1 scribu4 years ago

  • Component changed from Editor to Post Types
  • Keywords reporter-feedback added; custom post type removed
  • Priority changed from normal to low

Could you post a step-by-step guide to reproducing this problem?

comment:2 goldenapples4 years ago

Yes, here's how I was able to reproduce the problem:

  • Took an existing WP2.9.2 working site with existing posts and pages.
  • Upgraded to WordPress 3.0-beta2-14697.
  • Added two new custom post types through the theme functions.php file:
function add_custom_post_types() {
	// Post type for video posts on home page
	register_post_type( 'solutions-videos',
					   array( 'label'=>'Videos', 'public'=>true, 'show_ui'=>true ) );
	register_taxonomy_for_object_type('post_tag', 'solutions-videos');
	// Post type for agent listings and offices
	register_post_type( 'agents-locations',
					   array( 'label'=>'Agents', 'public'=>true, 'show_ui'=>true, 'hierarchical'=>true, 'supports'=>array('title','editor','page-attributes', 'custom-fields') ) );
}

add_action ('init','add_custom_post_types');


  • Next, I changed some of my existing pages to 'agents-locations' and some of my existing posts to 'solutions-videos' through phpmyadmin. I edited the entry for each of the posts I wanted to recategorize, changing only the 'post-type' field to the correct slug ('solutions-videos' or 'agents-locations').
  • Finally, I edited the newly custom-typed posts through the Videos -> Edit submenu page. Editing content, meta fields, or attributes all work as expected. However, changing the title or the slug and updating changes the 'post-type' field in the database back to the original.

Hope this was clear enough. Server environment was PHP 5.2.4, Apache 2.2.15, on Linux CentOS.

comment:3 scribu4 years ago

Does it work if you create a new post throught the admin?

comment:4 goldenapples4 years ago

Yes. Creating a new new post in the custom post type through the admin works fine. Editing a post a created through the admin, changing its title and saving also behaves as expected - the post still remains within the custom post type it was created as.

The problem I'm seeing is only happening when the post-type is changed directly through the database.

comment:5 scribu4 years ago

Can't reproduce.

I remember manually changing the post types on a site and it worked fine.

Maybe you have a plugin that is causing it.

comment:6 follow-up: goldenapples4 years ago

Strange. I have another site I'm working on where I entered all the custom posts through the admin, and the same thing is happening. I'll dig around and see if I can figure what's causing the problem.

comment:7 in reply to: ↑ 6 michaelh4 years ago

Replying to goldenapples:

Strange. I have another site I'm working on where I entered all the custom posts through the admin, and the same thing is happening.

ticket:13472 reported the same thing but couldn't duplicate.

comment:8 goldenapples4 years ago

Now I can't reproduce. I deactivated my "Custom Field Template" plugin, thinking that might be the problem, as that was the only plugin I had active which hooked into "edit_post". The problem went away. Then I reactivated the plugin. Still couldn't duplicate the problem.

So... I have no idea. Feel free to close this ticket, unless someone else reports similar issue...

comment:9 michaelh4 years ago

Stephen Hammer is reporting this via wp-testers email. Anyone have any ideas?

comment:10 michaelh4 years ago

  • Priority changed from low to normal

comment:11 michaelh4 years ago

  • Priority changed from normal to low
  • Resolution set to worksforme
  • Status changed from new to closed

False alarm, kind of. The Custom Field Template plugin looks to be changing the post_type field to post when changing a custom post type from Publish to Draft via Quick Edit.

Closing as worksforme.

comment:12 dd324 years ago

  • Milestone Unassigned deleted
Note: See TracTickets for help on using tickets.