• Resolved VFHwebdev

    (@vfhwebdev)


    I can’t seem to delete sites from my WordPress Network.

    From wp-admin/network/sites.php I click “delete” for the site I want to remove. It sends me a confirmation email. I click the link in the confirmation email.

    And the site still shows in my list of sites as “Deleted”. But it’s still there. It seems like it is just marked as Deleted, but isn’t actually gone. I’d like to really remove it, but can’t see any way to do so.

    What am I missing?

Viewing 15 replies - 1 through 15 (of 15 total)
  • Weird. I don’t recall ever been asked to confirm deletion via email. Perhaps you could try to delete it on the site’s admin via tools > delete site (…/wp-admin/ms-delete-site.php), but you should be able to do it from the network admin.

    Thread Starter VFHwebdev

    (@vfhwebdev)

    I’ve tried that with the same result. So that confirmation email isn’t expected behavior? And marking the sites as “deleted” but leaving them in the list of sites on the Network isn’t expected either?

    Thread Starter VFHwebdev

    (@vfhwebdev)

    The language in the email confirmation appears to have come from wp-admin/ms-delete-site.php so I think that’s expected behavior.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    You get a confirm if you’re not a network admin.

    Looking in that file my guess is that this is used when users (not network admin) delete their site. Then the blog status gets updated to ‘deleted’ until confirmation. Upon confirmation the blog’s tables should get dropped.

    Still, I would expect that the network admin should be able to delete a blog, marked as deleted or not.

    Trying it on my site from the network admin, I get asked to confirm deletion, ms-delete-site.php is not used there.

    URL:
    …/wp-admin/network/sites.php?action=confirm&action2=deleteblog&id=[ID]&msg=You+are+about+to+delete+the+site+[SUBDOMAIN].&_wpnonce=[NONCE].

    text:
    Confirm your action
    You are about to delete the site [SUBDOMAIN].
    [confirm]

    When I confirm, the site’s tables get removed from the database.
    So, to me this seems unexpected behaviour indeed.

    Could you try to create a new site and see if this one can be deleted? If it doesn’t cause the same issue, it may be just a problem with this one site, in which case you could drop its database tables…

    Thread Starter VFHwebdev

    (@vfhwebdev)

    I am the network admin and I tried it with a new site.

    After clicking the link in the confirmation email, the tables still don’t get dropped.

    I’m wondering if a plugin is getting in the way. I haven’t installed any new Network plugins or updated any of the existing network plugins. Could a plugin that’s only active on a sub site interfere with the Network like this?

    Update:
    Hmmm… This morning my network auto updated to 4.1.1 I just tried to delete a site again and this time I didn’t get the email confirmation but the tables didn’t get dropped either. The site is just marked ‘deleted’ here network/sites.php

    It’s beyond my scope, but it seems you get stuck after the status gets updated @ /wp-admin/includes/ms.php#L83.

    Below that line, there are a couple of cases mentioned in which the blog does not get deleted:

    1. If a full blog object is not available.
    2. If it’s the initial, main, or root blog.
    3. If ms_files_rewriting is enabled and upload_path is empty.

    1. I’m not sure what this is, but would guess ID, domain, path and site name.

    2. Not the problem, since it’s the same for new blogs.

    3. Is you site 3 years old?

    ms_files_rewriting used to be enabled by default (3 years ago), I don’t know if this changes on updates, perhaps it is still enabled on your site… You can find it, f.ex. via phpMyAdmin, in the main site’s (wp)_sitemeta database table. If the value is 1, you could try to change it to 0, however, there must be a reason why WordPress does not change this automatically… Perhaps wait for a confirmation that this is ok.

    upload_path can be found in the blog settings (network admin), but on my site, it’s empty for all sites. If you would not have access to the database to check the above, you could try to fill the upload_path with the folder where you store uploads (/wp-content/uploads/).

    I hope this helps. GL with it!

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    I can’t reproduce that on a clean site. I hit delete as the Network Admin, click confirm (no email), and it kills the site as desired.

    Thread Starter VFHwebdev

    (@vfhwebdev)

    Axel13, I don’t see that ms_files_rewriting setting in my sitemeta table. Is ms_files_rewriting the meta_key?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Yes it is, but it looks like it doesn’t always get set?

    https://core.trac.wordpress.org/ticket/25819

    VFHwebdev, if ms_files_rewriting is missing, perhaps you can – take a backup first – then insert it, if meta_id 19 is free…

    meta_tag = ms_files_rewriting
    meta_id = 19
    site_id = 1
    meta_value = 0

    The rest is not selected (functions) and not checked (null).
    Looking at the image of the settings is perhaps easiest.

    Again I’d prefer to see someone confirm that this is good advice though… but that’s what I would do.

    Thread Starter VFHwebdev

    (@vfhwebdev)

    Well, you’re onto something here!

    I added ms_files_rewriting to my _sitemeta table as Axel13 suggested and I could delete my old sites! Woot!

    However… the images on my sites all vanished. I changed the value of ms_files_rewriting to 1 and the images came back, but I could no longer delete old sites.

    So I guess I’m kind of sort of OK now. (I don’t delete sites often). But manipulating that DB field every time I need to delete a site seems like a clunky work around.

    Is there a way I can leave it set at 0 and still have my images load properly?

    It seems like there’s still something going wrong on my site.

    (And thanks for all the help BTW!)

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    I’m trying to remember what I did when I moved my images….

    add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );

    What happens if you put that in a mu-plugin?

    I think you wrote about this, Mika 🙂
    http://halfelf.org/2010/moving-your-images-for-multisite/
    http://halfelf.org/2012/dumping-ms-files/

    VFHwebdev, your files are likely in a directory ‘blogs.dir’ instead of ‘uploads’. I assume the 0 or 1 changes where WordPress looks for the files. Perhaps the posts could help, but I wouldn’t try it anywhere else than on a test site.

    In fact, especially since finding a solution is on the core dev’s to do list and while/because I’m not at all sure it would, I’d probably delete the ms_files_rewriting again to make sure it does not interfere with any future update that aims to solve this.

    If I’d need to delete a site once in a while, I’d leave it there, but I’d turn off automatic updates and verify whether a solution is included before updating.

    Alternatively, if I would want to get the issue out of the way permanently, and if the site is not too big and if it’s not a drama when it’s offline for a (little) while, I’d install a new WP on a temporary domain (could be subdomain or a free .tk), import the sites there and when all is ok, move it to the current domain.
    – my2ct.

    (And you’re welcome, glad you at least managed to delete the site 🙂

    Thread Starter VFHwebdev

    (@vfhwebdev)

    Ok, I’ve removed that meta_key.

    I think for now because I don’t need to delete sites often I’ll just add it back when needed and hope a future core update fixes this.

    Thanks for all the help!

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘How do I delete sites?’ is closed to new replies.