• I guess this is a combination request for PHP help and request for a feature. Basically, I goofed and imported a massive blogroll into my default category in the link manager. WP doesn’t allow deletion of the #1 category (which is where I accidentally imported them). So, I created a second category and, since there’s no “Select All” option that would let me do a bulk deletion, spent an hour selecting each link individually then using the “Move” button to transfer them to the second category. I figured, once I did that, I could delete the second category and they’d be gone.
    Well, that’s how I thought it would work, at any rate. Instead, it just transferred all of the links back to the default category. In other words, I wasted an hour of my time and still haven’t accomplished anything.
    I’m thinking there must be a way I can go through phpMyAdmin and dump all of the links, but since I don’t know diddly squat about PHP (yet), I’m afraid to try figuring it out myself. Any code monkeys out there willing to give me a tip?
    (And, WP, would y’all please add in the ability to select multiple links for deletion? Pretty please? Huh?)

Viewing 10 replies - 1 through 10 (of 10 total)
  • Seems to me you could go ahead and delete them using phpMyAdmin…I’d do a backup of the “wp_links” table first, just in case.
    Wait for someone to second this suggestion though….I’m new at this myself. ??

    run the following SQL query in your myphpadmin (Clicking on the SQL tab on top when you are browsing your wordpress table will bring up a text box where you can type SQL queries)

    DELETE
    FROM
    main_links
    WHERE link_category = 2

    to delete the links with link_category = 2. If you want to delete category 3, make that WHERE link_category = 3
    Back it up, just in case, before you do it, but I tried creating some new links in a category and then deleting them, just to be sure it works.
    ??

    Thread Starter 1766

    Hm. I tried that but got an error message:
    <pre>#1146 – Table ‘kate_blog.main_links’ doesn’t exist</pre>
    The links are there, the categories are there, so something exists. I just don’t know what.
    (And, yes, I promise I’m going to learn PHP. But not today.)

    I would just browse the “wp_links” table visually since you’re using phpMyAdmin. PhpMyAdmin provides a check box on each entry so you can remove only the ones you select.

    Alan: her problem was that there were too many to check off, or delete individually.
    So Kate, you try kate_blog.main_links in the place of main_links in the SQL query that I suggested.
    The idea is to delete all links with the link_category = some value from the table that contains the links, which, in my SQL database is main_links.
    I hope that explains it better.

    Kate, the naming is just wrong – I assume you don’t have main_links (probably wp_links) so check and see. If that is what you have then 2fargon’s suggeston will work once you have renamed main_links to the correct name. On my system I would have:
    DELETE FROM wp_links WHERE link_category =2

    Thread Starter 1766

    Ok, don’t laugh at me but that didn’t work. However, after noting Alan’s comment I realized that where I needed to be deleting was in the wp_links section. So I ran this SQL query:
    DELETE FROM wp_links WHERE link_category = 1
    And it worked like a charm. Phew! I was definitely not looking forward to checking off hundreds of little boxes again.
    Thank you both!

    Thread Starter 1766

    Whoops. If I’d flipped back to this window faster, I’d have seen Beel’s comment. Thank you anyway, Beel. Hopefully someone else running into this problem will find this helpful.

    well, there you go ??
    Sorry for the confusion regarding the name. My “main” is your “wp”!!
    Good to know it worked.

    Thank you! Thank you! This was very helpful! ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How to do mass deletion in link manager?’ is closed to new replies.