• Hi there,

    I have used the following SQL to change the status of a series of drafts to published stats:

    UPDATE 'wp_posts' SET 'post_status' = 'publish' WHERE 'post_status' = 'draft'

    (Please note that the backticks in the quoted SQL were replaced by ‘ per the forum rules.)

    This works fine as far as setting the status goes, but it is not updating the count for tags and categories.

    For example,

    4 published posts have the tag “Banana” applied
    3 draft posts have the tag “Banana” applied
    In Posts/Post Tags, the tag list reports that “Banana” is applied to 4 posts, and clicking on the number 4 reveals the 4 posts in the posts list; this means that the tag count does not include draft posts.

    I then run the SQL above. The result is the following:

    7 published posts have the tag “Banana” applied
    0 draft posts have the tag “Banana” applied, because the SQL means there are no more drafts

    In Posts/Post Tags, the tag list reports that “Banana” is applied to 4 posts (which is wrong), and clicking on the number 4 reveals 7 posts in the posts list (which is right).

    So, manipulating the post status directly is leading to an incorrect count of the number of posts a given tag is applied to.

    Is there a way to refresh the tag/category counts?

    …Mike

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘SQL: Directly changing the post status from Draft to Publish breaks tag counts’ is closed to new replies.