• Resolved auzzy

    (@auz1111)


    I can see the post type change when selecting the wanted type on the post, but once published the change is not saved.

    Otherwise, a very useful plugin!

Viewing 7 replies - 1 through 7 (of 7 total)
  • I can suggest a temporary solution of this issue.

    Add the following code to the end of
    wp-content/plugins/post-type-switcher/post-type-switcher.php
    file. Just before php closing tag (?>).

    function pts_save( $post_id, $post ) {
    	if ( isset( $_POST[ 'pts_post_type' ] ) && $_POST[ 'pts_post_type' ] != $post->post_type ) {
    		$cur_post_id = $post_id;
    		//checking if current post is a revision
    		if ( false !== ( $id = wp_is_post_revision( $post ) ) ) {
    			$cur_post_id = $id;
    		}
    		//updating post type
    		set_post_type( $cur_post_id, $_POST[ 'pts_post_type' ] );
    	}
    }
    
    add_action( 'save_post', 'pts_save', 10, 2 );
    Thread Starter auzzy

    (@auz1111)

    Thanks a lot for that one! Also, gave me some more insight into the workings of the plugin after taking a look.

    Thanks!

    Hmm, seems like that could should have been in the plugin all along. How did it work without that?

    kiddhustle

    (@kiddhustle)

    Hey Vladimir

    Nice fix!

    Yea.. How does this plugin switch the post type without that code in there? Trippy..

    ericperson

    (@ericperson)

    It didn’t work for me in 3.1.1—I added the code but nothing changed. I also tried deactivating and reactivating the plugin after editing.

    Is this working for anyone in 3.1.1?

    I didn’t see any problems with this fix on WP 3.1.1.
    Can you check pts_post_type post parameter (with firebug)? New post type will be sent in this parameter when you save or publish post.

    Plugin Author John James Jacoby

    (@johnjamesjacoby)

    Apologies. Plugin was updated but new version was never pushed out.

    Version 0.3 will fix these issues.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Post Type Switcher] Broken after 3.1’ is closed to new replies.