• Can someone help me out?

    If a post has 1 comment i want that post to be moved to category X.
    If post has 2 comments move tp catetegory Z.
    If post has more then 2 post move to category Y.

    If 0 comments do nothing.

    • This topic was modified 3 years, 10 months ago by Gustav.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Would this be something that is done on a regular basis?
    What happens to the category that the post is already in?
    Does your permalink structure have the category in it?
    Would it be easier to use tags instead?

    Moderator bcworkz

    (@bcworkz)

    wp_set_post_categories() will do as its name suggests. The 3rd parameter controls whether existing categories are removed or not. wp_set_object_terms() will do the same thing, but you can do so for any taxonomy term and any object, assuming a taxonomy to object relationship is already established.

    Thread Starter Gustav

    (@4ever16)

    @joyously Yes i think so ( allways check comments count and move the post that post has x comments or so (sorry very bad english ) )

    It also can be done with a button doesnt need to be cron job. But check all posts! Not 1 by 1.

    PS! I wrote wrong in first post about “Y” function. I ment if 3 comments or more move to category Y.

    What happens to the category that the post is already in?

    Option 1. Allways check comment count and move if x comments.
    Option 2. If post is in category Y do nothing with that post.
    Option 3. Allways check comment count but exlude category Y.

    Or maybe i missunderstood you.

    The categories isnt effected (only posts are moved to specific category)

    Does your permalink structure have the category in it?
    Yes and no. Im building the site so i can choose.

    Would it be easier to use tags instead?
    No. I use 0 tags on the site.

    @bcworkz sorry just telling me that doesnt help me im a begginner ++ i know some stuff but not so advanced.

    • This reply was modified 3 years, 10 months ago by Gustav.
    • This reply was modified 3 years, 10 months ago by Gustav.
    • This reply was modified 3 years, 10 months ago by Gustav.
    • This reply was modified 3 years, 10 months ago by Gustav.
    • This reply was modified 3 years, 10 months ago by Gustav.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘If x comments move to other category’ is closed to new replies.