• I’m having a complete nightmare with this. I have 1,005 default posts to convert to a custom post type. However it’s only posts from a specific category that need converting.

    I am aware of the ‘Convert Post Types’ plugin which looks ideal, however it isn’t compatible with my clients’ hosting (typical).

    Therefore I’m trying with the following SQL code but with no luck:

    UPDATE wp_posts
    SET post_type='featured-property'
    WHERE post_type IN (
        SELECT ID FROM wp_posts
        INNER JOIN wp_term_relationships
        ON (wp_posts.ID = wp_term_relationships.object_id)
        INNER JOIN wp_term_taxonomy
        ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
        AND wp_term_taxonomy.taxonomy = 'category'
        AND wp_term_taxonomy.term_id = 442
    )

    I keep getting the following error:

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ” at line 11

    The only thing I can think of doing is converting the posts one by one in Sequel… however this would take hours so it’s only a last resort.

    Can anyone see what might be missing from my SQL query?

Viewing 1 replies (of 1 total)
  • Not sure but does the 422 need to be a variable or be incased in '422', there was a post for WP_Query($args) yesterday and the value true would not work without being 'true'

    Just a guess!

    AND wp_term_taxonomy.term_id = '442'

    David

Viewing 1 replies (of 1 total)
  • The topic ‘Changing Post Type Depending on Category’ is closed to new replies.