Support » Plugins » Post Type Switcher plugin post_type bug

  • I’m encountering a bug with the Post Type Switcher plugin.

    When I have Post Type Switcher enabled post revisions are getting their post_type field in the DB set to ‘post’ rather than ‘revision’.

    I’ve disabled all other plugins and verified this is still happening. Anybody else experiencing this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Drew Jaynes

    (@drewapicture)

    WordPress Core Developer

    I can verify this issue as well, been banging my head against a wall because these revisions were showing up in queries from another plugin.

    Drew Jaynes

    (@drewapicture)

    WordPress Core Developer

    This can be fixed by added a check for the ‘revision’ post type.

    Open up post-type-switcher.php

    At about line #126 (inside function pts_save_post() )

    Add this just before the line starting with set_post_type( $post_id ...:

    if ( $post->post_type == 'revision' )
    		return;

    For posts already affected by this, you’ll have to run a DB query, something like this:

    UPDATE wp_posts set post_type = "revision"
      WHERE (post_name LIKE "%revision%" OR post_name LIKE "%autosave%")
      AND post_status = "inherit"
      AND post_parent != 0
      AND post_type != "revision"
    Moderator John James Jacoby

    (@johnjamesjacoby)

    This should be fixed in 1.1.

    Many thanks for the fix! What about the issue with Post Type Switcher and Advanced Custom Fields?

    http://wordpress.org/support/topic/post-type-switcher-bug-with-advanced-custom-fields?replies=5

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Post Type Switcher plugin post_type bug’ is closed to new replies.