• Resolved gregorsmith

    (@gregorsmith)


    OK, how best to phrase this, I’m needing a way to select posts from a certain category then quickly mass replace the post excerpt using the post content.

    I figured this would be relatively easy in MySQL and I was able to fill in blank excerpts using a quick:

    UPDATE wp_posts
    SET post_excerpt = post_content
    WHERE post_excerpt IS NULL OR post_excerpt = ''

    But since the old post_category column in wp_posts isn’t being used finding a way to pull the post id, post_content and post_excerpt information from wp_posts, the object_id and term_taxonomy_id info from the wp_term_relationships tables and replacing the post_excerpt with the post_content if a term_taxonomy_id is 3 is proving to be more difficult than I first imagined.

    Can anyone think of a SQL query that might pull this off?

Viewing 1 replies (of 1 total)
  • Thread Starter gregorsmith

    (@gregorsmith)

    Resolved, I used this query in case anyone else has this specific issue

    update wp_posts p
    set p.post_excerpt = p.post_content
    where p.ID in (select tr.object_id
    from wp_term_relationships tr
    where tr.object_id = p.ID
    and tr.term_taxonomy_id = 3)
    ;
Viewing 1 replies (of 1 total)
  • The topic ‘Database Hackery’ is closed to new replies.