Ready to get started?Download WordPress


Post Type Switcher plugin post_type bug (5 posts)

  1. VFHwebdev
    Posted 2 years ago #

    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?

  2. 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.

  3. 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' )

    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"
  4. This should be fixed in 1.1.

  5. VFHwebdev
    Posted 2 years ago #

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


Topic Closed

This topic has been closed to new replies.

About this Topic