• 1. I tried, by querying phpMyAdmin, to delete older posts in particular categories.

    The following “seemed” to successfully show posts in one particular category(1772) that are over 400 days old:

    SELECT *
    FROM wp_posts a
    LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id )
    LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )
    LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id )
    LEFT JOIN wp_terms e ON ( e.term_id = d.term_id )
    WHERE e.term_id =1772
    AND DATEDIFF(NOW(), <code>post_date</code>) > 400

    However, the following query, apparently, failed to delete the aforementioned posts:

    delete a,b,c,d
    FROM wp_posts a
    LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id )
    LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )
    LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id )
    LEFT JOIN wp_terms e ON ( e.term_id = d.term_id )
    WHERE e.term_id =1772
    AND DATEDIFF(NOW(), <code>post_date</code>) > 400

    What did I do wrong, above?

    2. Separately, I tried the following phpMyAdmin query to merge my category 7 into my category 112731:

    UPDATEwp_term_relationships`
    SET term_taxonomy_id = 7
    WHERE term_taxonomy_id = 112731;`

    That also failed, apparently. What did I do wrong there?

Viewing 1 replies (of 1 total)
  • Thread Starter 040310b

    (@040310b)

    The “delete query” I was attempting in 1, above, worked, but, apparently, the entire category was deleted, instead of just tweets older than 400 days.

    What did I do wrong?

    delete a,b,c,d
    FROM wp_posts a
    LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id )
    LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )
    LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id )
    LEFT JOIN wp_terms e ON ( e.term_id = d.term_id )
    WHERE e.term_id =1772
    AND DATEDIFF(NOW(), <code>post_date</code>) > 400

    Separately, I tried the following phpMyAdmin query to merge my category 7 into my category 112731. Is the query correct, for that purpose?:

    UPDATE wp_term_relationships
    SET term_taxonomy_id = 112747
    WHERE term_taxonomy_id = 112748;
Viewing 1 replies (of 1 total)
  • The topic ‘Manipulating Categories with phpMyAdmin’ is closed to new replies.