Generally, around the 1910s/20s. This is due to a number of factors. One, the death tolls from WWI and the 1919 Influenza Pandemic were astronomical, and that factor alone made observing 19th century mourning customs incredibly difficult, especially in Britain and France, but also in America. Couple that with the increasing speed of business and the presence of middle class women in public due to the war and societal changes, and a mourning mother couldn't spend a year in seclusion and crepe anymore. It wasn't practical, and it was starting to be seen as macabre. (It was also associated with the previous generation, and thus, less modern, less fashionable, less up-to-date.)
But the bigger factor, I think, is the development of photographic technology. In the 19th century, getting a photograph taken was a Big Deal, especially for lower middle class folks. The time it took and the expense were big factors, as well as the fact that most people didn't own a camera themselves. They had to hire a photographer, the way that people in previous eras had to hire an artist to paint a portrait or a miniature to capture someone's likeness. So that expense was saved for special occasions like weddings and, yes, deaths. The death of a child was a chance to take a photograph of all the children in the family, to remember what the family looked like and to cement that child's existence in the family visually, especially as visual culture became increasingly important. Having a photograph of a dead child meant they could hold on to the image of that child, almost as they had looked in life. And with the idea of Heaven being one big happy family home, that was the image people trusted they would see again in the afterlife, especially Americans. It was documentation and reassurance, all in one, so it was a worthwhile expense to take post-mortem photos. But when cameras became more common in the teens and twenties, it was increasingly easy to have photos of your children that weren't staged portraits. Candid photography became a thing, because the exposure times decreased. A post-mortem photo was now unlikely to be the only image of your child, and people preferred smiling, happy images of their children, unsurprisingly.
Lastly, the final nail in the coffin of post-mortem photography (terrible pun, but how could I resist) was the decline in infant mortality. As obstetrics improved and treatments/preventions for childhood diseases increased, the likelihood of child death decreased, bringing with it a decreased need to take photos of dead children. Another plus for childhood immunization. However, interestingly enough, we are seeing a rise in parents, especially mothers, taking photos of their stillborn babies or infants that die shortly after being born, from informal pictures taken in the hospital to portraits set up with the dead baby and the mother. Because of the push to make miscarriage/stillbirth less taboo, parents are increasingly willing to take photographs of themselves and their dead babies. The convention until recently had been to put the loss out of your mind, get over it, and try again. Now, parents are encouraged to grieve and deal with that grief instead of pretending an infant death or stillbirth was just a medical complication. I don't know that I'd necessarily call it "fashion" for taking pictures of dead children, but it is part of the visual culture of documenting our lives and our losses that dominates the 21st century.
That's my sense of things as a historian who works on death and culture in the long 19th century and has spent a lot of time reading about post-mortem photography. I don't recall any specific books on children's post-mortem photography and its trends, but if I come across any in my bibliographies, I'll add them to the post.
If we're talking about Western-style memorial photography of deceased children, not crime scene photography or photojournalism, the short version is that it hasn't fallen out of favor -- at least not entirely. Memorial photography of deceased children, including infants, emerged back on the radar in the 1980s and 1990s and persists through today -- these photographs are more likely to be called "remembrance photographs" than "postmortem memorials" (if the grieving parents of the 1850s ever called their own images that) and originate largely in hospital settings. Parents are permitted to take their own photographs after a loss or to engage the services of a professional photographer, either in-house or supplied by a professional organization like [Now I Lay Me Down To Sleep](https://www.nowilaymedowntosleep.org/]. For a child whose life was particularly brief and whose physical presence in the sight of its parent may have been fleeting, these photographs stand as an enduring documentation that this child did in fact exist -- that whatever physical condition in which the child appeared at time of death it had a physical body that could be held and a visible body that can be recalled to memory. For some parents this exactness of image is preferable to a more impersonal or intangible alternative, having no image at all (even a mental one) or only a nebulous memory of what they saw and touched before cremation or burial; for some parents it is undesirable, even for similar reasons. The relative ease in the modern 21st-century era of documenting an older child's life and death may diminish the need for an expressly postmortem image, but postmortem memorial images of infants capture the faces and features of individuals whose existence was brief, and whose time with the family even as inert remains might have been a short window, hours or even minutes. The community of families who have lost one or more children in infancy and early childhood is smaller today than it once was due to massive advances in public health and pediatric medicine, but there remains a need for such formal aids to remembering the deceased.
The practice of making mourning portraits of deceased children predate photography, but the expense of commissioning a painting (for those bereaved parents who were not themselves feeling up to the task) was financially limiting. The relative financial accessibility of the daguerreotype facilitated the creation of indelible images of the deceased as they were at the time of death -- which often meant a professional photographer paying a house call to the residence in which the individual had died. The relative prevalence of deaths in the home rather than in hospital allowed for photographs of unembalmed, recently deceased family members not only in a casket surrounded by memorials but also in the bed in which they had died, or laid out on a familiar couch with a book or a favorite toy in the case of young children. Some mothers were photographed holding their dead children, as if they were reading to them. Childhood disease and mishap were sometimes legible in these photographs as the cause of death, but more often the deceased were positioned to suggest peaceful sleep, often photographed from close up with an emphasis on the face.These images might be disseminated among close friends of the family or retained for private use. The accessibility of photographic equipment by families themselves took off with the emergence of the roll-film Kodak camera in 1888, resulting in another transition from the formal professionally-taken portrait to the homebrewed keepsake. Photographic formats originally intended for cheerful distribution, like the postcard, found new life as an aid to collective familial grieving.
Even at the height of postmortem photography's popularity, it did not enjoy total cultural acceptance in those countries where it was practiced. Not all or even most professional photographers provided these services; industry publications of the time often speak frankly to photographers' discomfort with the work and dissatisfaction with the resulting images. The broader transition away from postmortem photography occurred in the first few decades of the twentieth century. In the United States and UK, this coincided roughly with the shifting of the dominant culture's funeral customs out of the home, the shifting status of the professional photographer, and the new emphasis on the personal camera.
The personal camera facilitated more informal commemoration of the living child or family member, even as the increasing medicalization and professionalization of death made the proximity between living and dead more remote. (Kodak's ad campaigns in particular were pretty relentlessly cheery -- all for photographing your happy family at play, not documenting a serious loss.) While more sterile forms of documentary death photography endured, the popularity of the private memorial photograph diminished. Public images of dead children still carried arresting weight -- newspaper graphics of murder victims, victims of famine, field photography depicting the human targets of wartime atrocities and bombing campaigns, all violent deaths occurring outside the Western viewer's own domestic sphere -- while at the same time, the ubiquity of death in the home was broadly speaking on the decline, and childhood mortality trended sharply downward in most developed countries.
For family members who had surrendered the tasks of preparing the dead to hospitals and mortuary homes, they might have experienced a diminished desire to commemorate the appearance of the deceased in the last stages of visibility rather than in the moments and hours after death. However, amateur and professional casket photographs taken in funeral homes persist -- I'm sure I have a few in my family album -- and there were still some contexts in which formal portraiture of the deceased had the advantage. Outside the mainstream, memorial portrait photography of the dead (both children and adults) retained strong roots in a number of immigrant and ethnic-minority communities, lasting well into the 1940s and in some cases the 1950s.
In New York's black communities, the tradition of postmortem photography persisted; professional photographer James VanDerZee produced memorial photographs from the 1910s through the 1950s and beyond. In addition to incorporating VanDerZee's significant skills in terms of composition and aesthetics, these photographs could incorporate decorative elements that couldn't be captured simply with a personal camera -- his images of the deceased and their families often incorporate poetry, Scripture, or visual motifs, in VanDerZee's words "to take away the gruesomeness of the picture" and suggest spiritual rest. For instance, in "Untitled (Grieving Man)", circa 1956, a text motif is imposed over the casket lid and background; in "Untitled (Open Casket)", circa 1949 a spectral angel is introduced at one corner of the chapel scene. In another postmortem photograph of VanDerZee's own sixteen-year-old daughter, Rachel, a smaller image of the girl as she appeared in life is incorporated in one corner of the print as well as a religious poem. These elements offered visual interest as well as consolation; few or none of these photographs appear to have been taken in a private home. VanDerZee photographed adults of all ages as well as children, not only in funereal contexts but at weddings, parties, and other social events. Documenting the death of a beloved child was part of the broader commemoration of black Harlem as well as the emotional process of participation in grief. Similarly, in the Hungarian immigrant community of Toledo, Ohio, photographers of the 1910s-1930s documented funeral arrangements alongside the casket as well as lines of mourners from the deceased's extended family. Rather than simply showcasing the deceased, the images located family members and mourners in the memorial image.
This isn't to say that there was a continuous and clear line of families prizing photographs off their dead loved ones from decade to decade, from the earliest mourning photographs of the 1850s to the most contemporary photographs of the present day -- styles of photography fell out of fashion, families felt discomfort with the same images their predecessors had cherished, and trends in how Westerners conceptualize grief came to ebb and flow -- but people of the past were participating in a tradition that predated photography, and modern viewers and photographers are continuing it.
Some reading:
'"For the last time”: the Hiltman-Kinsey post-mortem photographs, 1918–1920', Lásló Kürti
The Harlem Book Of The Dead, James VanDerZee ed. Owen Dodson, Camille Billops
IIRC Howard Burns' second and third volume of the Sleeping Beauty series of postmortem photography books discuss modern postmortem photography and its uses for those grieving the loss of children and infants.