Viewing 10 replies - 16 through 25 (of 25 total)
  • t31os_’s query has screwed my categories. all my categories are deleted. i am using WP 2.8.6. Please use with care.

    Which is why Michael replied suggesting that any attempt to use such a query should be preceded with a backup of your database. I can’t test for all cases.

    If you really need to delete all the tags, then you can look at how WordPress does it, if i remember correctly it’s a loop (query per tag). Alternatively there’s the option of soliciting a professsional to write a query for you.

    Sorry the query caused an issue, the intention was to help, and my interest was in resolving a problem not making one, but i would say (although i didn’t previously state), complex queries should always be following a backup of important data (though i’m sure i don’t need to point out the importance of backups here anyway).

    hi t31os_,
    my intention was not to hurt you. we all know that we try to help each other. I just warned people that it blew my database.

    Hi, no problem bekar.. ??

    Simply pointing out i do care if my suggestions cause a problem for someone, but all the same i can’t (and won’t) take responsibility for any users inability to backup data before performing queries like the above.

    Not meaning to bite at all, just making my stance clear in regards to code causing problems.

    Nagmay

    (@gabrielmcgovern)

    MichaelH had the right idea with: “Then use the Bulk Delete mechanism to delete 999 tags at a time.”

    It’s safe and efficient.

    … But I, like others on this tread, want to only delete the tags with low post counts. Unfortunatly, you can’t select “sort by count” on the tag admin page. So here’s how to temporarily hack that functionality:

    1) Open /wp_admin/template.php

    2) Go to line 721 :

    $args = array(‘offset’ => $start, ‘number’ => $pagesize, ‘hide_empty’ => 0);

    3) Temporarily change it to:

    $args = array(‘offset’ => $start, ‘number’ => $pagesize, ‘hide_empty’ => 0, ‘orderby’ => ‘count’);

    This will cause the tag list to sort by count for your bulk deletion needs.

    Make sure to change it back when you are done.

    but i cannot delete 999 tags at a time. it says “Request URI too large…..”

    what should i configure with my host to increase the request uri?

    The problem with using the in-built functionality with or without gabrielmcgovern’s change above is that you’ll essentially be performing 1 query per tag, which is far more intensive for any server to process then a single query that deals with the lot (delete 1000 tags = 1000 queries).

    I think that’s why you end up with a “Request URI too large”, because you’re asking too much from the server.. i could be wrong of course..

    I think i realise the problem that may have occured before, i believe the delete line should actually be… (i think)..

    DELETE a,c

    Which leaves the JOIN to the relationships table(b alias) as optional in the query.

    EXPLAIN command is quite helpful figuring out queries, though you can’t use it on DELETE queries (*sigh).. For the most part deletes are select queries (in my mind), but with minor differences… it’s awkward to test these queries without removing data (it’s not fun adding and removing post tags over and over, and over… lol)..

    I’d welcome anybody else’s input regarding delete queries .. if not only to confirm or deny what i’ve said above..

    This worked great for me, thank you!!

    Do you have a blog/paypal, i can buy you a coffee or a beer?

    Aloha…

    Thanks t31os_

    This worked great for me, thank you!!

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘SQL Query to delete all tags’ is closed to new replies.