Forums

Post Type Switcher
[resolved] Switch to Custom Type Not Being Saved (5 posts)

  1. Clif Johnston
    Member
    Posted 1 year ago #

    When switching from post type posts to a custom post type (e.g. movies), the change is not committed when saving the post.

  2. ianaleksander
    Member
    Posted 1 year ago #

    I'm having exactly the same problem. I think that it worked fine up until 3.1, this is the first time I'm using it past the upgrade.

  3. auz1111
    Member
    Posted 1 year ago #

    I am having the same issue... only tried after 3.1, though.

  4. vladimir.s
    Member
    Posted 1 year 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 );
  5. 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

About this Topic