WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Post Type Switcher] Post types do not change

[Resolved] [Plugin: Post Type Switcher] Post types do not change

Viewing 6 replies - 1 through 6 (of 6 total)
  • Same here.

    +1. It seems that the functionality is still working in the plugin (i.e., When you choose a new post type in the drop down and click the “OK” button, the jQuery works correctly to update the hidden “#post_type” element.)

    However, perhaps the WP3.1 changes to /wp-admin/post.php core file (the action of the form) make it so that it no longer respects changes made to the post_type parameter. I couldn’t figure out if this was the case or not, or how to fix the plugin…

    Any one else?

    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 );

    Thank you so much vladimir. I really needed that plugin and it is working on the first few posts so far.

    Any idea how to make it work on the bulk edit screen?

    Plugin Author John James Jacoby

    @johnjamesjacoby

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

    Version 0.3 will fix these issues.

    Thanks for the update, seems to be working fine now.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] [Plugin: Post Type Switcher] Post types do not change’ is closed to new replies.