The Taliban wants to replace the current ambassadors with their own representatives, but other governments don't want to host them.
In our modern world, different countries have a lot to do with each other. They trade stuff, they join together to form international pacts and organisations, their citizens head abroad for work or leisure… the list goes on.
Because of this, it has become custom for nations to appoint specific people whose job is to live abroad and act as a representative of their home country. These ambassadors usually live and work in embassies. They perform a range of responsibilities, including advocating for and offering assistance to any of their fellow citizens who are currently in the foreign country and need help. Foreign diplomats also receive special treatment. For example, they are often not beholden to all the laws of the country they reside in - a concept known as diplomatic immunity.
Ambassadors are appointed by and work for their own government, which means it’s not uncommon for them to be replaced if a new party comes to power. Governments can also recall existing ambassadors (i.e. tell them to pack up and come home) whenever they want. Often, this is used as a political tool with which governments can signal annoyance towards the country that their ambassador is living in. In fact, France just did this with its ambassadors to America and Australia because it was pissed about being left out of a new security pact. (Having made its point, it sent the diplomats back about a week later.)
Part of the point of the foreign diplomacy system is that governments often host the embassies of countries they don’t see eye-to-eye with. China and America have embassies in each other’s countries, for example. But where the ambassador situation can become rather sticky is if there is debate about the legitimacy of a country’s government. This isn’t as uncommon as you might think. Right now, it’s happening with Afghanistan.
The old Afghanistani government has fled abroad and the Taliban have uncontested control of the country. However, no government in the world has officially recognised the Taliban as the legitimate government of Afghanistan. That means any attempts the Taliban makes to do government-y things on the international stage (like send a representative to fill Afghanistan’s seat in the UN) is being rebuffed. And this applies to Afghanistan's embassies too - governments around the world don't want to host representatives of what many consider to be a terrorist organisation.
The issue is that this has left in limbo the Afghanistan embassies that existed before the Taliban swept to power in August 2021. These buildings are currently still staffed by the people who got the job under the previous regime. Said staff members have been left in a very difficult position, where no one is really sure what their legal status currently is.
On one hand, these people no longer seem to fit the traditional description of diplomats. Not only are most unwilling to be representatives of Taliban, the Taliban probably also doesn't want the current ambassadors to represent it. (Some of the current embassies are headed by women, which doesn't fit with the Taliban's political ethos). On the other hand, most Afghan diplomats are carrying on doing the same embassy-related stuff they were doing before. Which is perhaps just as well, because with thousands of Afghans fleeing abroad, there is currently a huge demand for embassy services such as help with paperwork and passports.
It’s not clear how long this situation can continue. There's no guarantee host countries will continue to let the rudderless embassies carry on as before. If staff members are no longer recognised as diplomats most will lose their right to remain in their host country. Few seem to want to return home, but they may have little choice. (Anticipating this possibility, several ambassadors have already applied for asylum in their host countries.)
Even if host countries remain sympathetic, being no longer backed by any government means embassies aren’t receiving any money, which they need to continue paying their wages and funding their operations. While they can charge the people who use their services, it seems unlikely that this will fill the funding gap entirely. And other governments aren't famed for a willingness to spend their taxpayer-funded revenue on foreigners. If Afghanistan's embassies shut down, it's likely cause yet more problems for Afghans.
Read our explainer on: international organisations.