WordPress.org

Forums

Post Type Switcher
[resolved] Broken after 3.1 (8 posts)

  1. auz1111
    Member
    Posted 4 years ago #

    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!

  2. Vladimir Statsenko
    Member
    Posted 4 years ago #

    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 );
  3. auz1111
    Member
    Posted 4 years ago #

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

    Thanks!

  4. GrandSlambert
    Member
    Posted 4 years ago #

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

  5. kiddhustle
    Member
    Posted 4 years ago #

    Hey Vladimir

    Nice fix!

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

  6. ericperson
    Member
    Posted 4 years ago #

    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?

  7. Vladimir Statsenko
    Member
    Posted 4 years ago #

    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.

  8. John James Jacoby
    BuddyPress/bbPress Lead
    Plugin Author

    Posted 4 years ago #

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

    Version 0.3 will fix these issues.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Post Type Switcher
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic