• Editing the WordPress Twenty Twenty-Five Theme

    Editing the WordPress Twenty Twenty-Five Theme

    Edited 11/05/2025: Solved thanks to a very kind person on Mastodon! Head here if you want to see the answer to my frustrations below.

    Or rather, trying to edit the theme and tearing my hair out for multiple hours… but I’m getting ahead of myself.

    I’ve been using WordPress for ten years now. I use it to run two sites with thousands and thousands of pages and posts. I’ve customised child themes. I’ve written my own functionality with PHP and WordPress shortcodes. What I’m trying to say is: I’ve got some experience. It’s not my day job, but I’m not an idiot.

    In 2018 WordPress introduced a new default editor called Gutenberg that was a much more visual, drag-and-drop interface. I hated it. Pretty much everybody hated it. I installed the Classic Editor plugin and never looked back.

    Last year after I quit my job I decided to devote a bit more time to my sites, especially this blog. I started with a visual refresh, and I decided to bite the bullet and use the very latest default theme – Twenty Twenty-Five. It’s a “block theme,” and it took me a while to get my head around making changes in the Site Editor rather than in a child theme. But making changes was fast, and I got the site mostly looking the way I wanted it. I was reasonably happy.

    This year I started a project to clean up my archives, which I call “tending my digital garden.” Every day I go to this page, which shows me all the posts for that calendar day going back 25 years. I scroll through them and look for stuff like broken links, missing tags and categories, malformed HTML. When I find one of them, I open it in the editor to fix it. This requires two clicks: 1) on the post title to open it in a new tab, and then 2) the “Edit Post” link in the admin toolbar. While this doesn’t seem like a lot, I’ve been doing it for hundreds of posts, every day since February. It adds up.

    On my previous theme (Twenty Sixteen), each post had a little “Edit” link that would appear if you were logged in. You can see an example on my Roald Dahl site, which still uses that theme. So why doesn’t Twenty Twenty-Five?!

    A screenshot from a post on RoaldDahlFans.com, showing an Edit link beneath a post

    Today I decided I’d had enough, and it was time to figure out how to add it in. Very quickly I found this page: How to Add an Edit Post Link to WordPress Posts and Pages. It’s clear that there’s an existing WordPress core function that does exactly what I need: edit_post_link. All I needed to do was figure out how to get that into my template, and it should just work, right? Except not.

    1. I’ve worked with child themes before, so I started by creating a child theme for Twenty Twenty-Five. To my surprise, when I switched over to it, I lost all formatting and styles on the site. All of those changes I made in the Site Editor are saved in the database and only apply to the parent theme, not the child. WTF THAT SUCKS. There was no way I was going to recreate all that work, and I didn’t fancy the idea of trying to edit the database directly to reassign the saved configuration to a new theme. Let’s try the other option.
    2. I installed the WP Code plugin and found that it already has a built-in snippet that consists solely of edit_post_link. Perfect. You have two options of how to insert it: you can have it automatically appear at designated spots (like before or after a post excerpt), or you can use it as a shortcode.
      1. I started with the automatic locations. No matter which option I selected, the Edit link would either not appear or appear at the very top of the site (i.e. not attached to the post). It seems like however the plugin is determining the location just doesn’t work with the Twenty Twenty-Five theme.
      2. I switched over to the shortcode approach and added the shortcode to my template (using the Site Editor and the Shortcode block) below each post in the loop on the Archive page. When I viewed it, it looked like it worked! Every post had an Edit link at the bottom. However, I noticed quickly that all of them had the same postID, the very first one in the loop. It was clear that the context of the current post was not being picked up. That’s fine; I saw in the documentation that that you can supply a post ID to edit_post_link. Folks, I tried multiple different ways of getting the post ID in there and nothing worked. So this method was a bust.
    3. I went back to the child theme. I found a plugin called Create Block Theme that would clone your current theme AND all your Site Editor changes into a new child theme. I tried it out and it worked perfectly! I now had a child theme of Twenty Twenty-Five and could make changes directly to the templates in the code. Great. I connected to my host and started looking at the files… and for the life of me, I could not figure out where the hell to actually make my change. Block themes seem to use HTML files as well as PHP. I tried editing template PHP files; I tried adding things to functions.php. I just could not get it to work.

    I asked Mastodon for help. I mostly got replies from people who misunderstood what I was trying to do or thought I was an idiot who couldn’t see the “Edit post” link in the toolbar. 🙄

    Time for the nuclear option – I got Rodd and walked him through the problem, which meant painstakingly taking him through every bit of research I’d done and which options I’d tried and showing him how they didn’t work. He had some more ideas that we tried – including making a custom block type – but every approach either didn’t work or was way complicated for something that should be EASY. In fact, it should be BUILT-IN. Why the hell isn’t it included in this theme?!

    In desperation I thought about doing it on the frontend. Maybe I could write some Javascript that would scrape the links on the post and… DUH, TAMPERMONKEY. I installed it and got it set up, and then pulled in Rodd for his superior DOM manipulation skills. Here’s our quick and dirty solution:

    (function() {
       'use strict';
    
       document.querySelectorAll('.wp-block-post-date').forEach((el)=>{
          const a = document.createElement('a')
          a.href = '/wp-admin/post.php?action=edit&classic-editor&post=' + /archive[/](\d+)/.exec(el.querySelector('a').getAttribute('href'))[1]
          a.appendChild(document.createTextNode(' [Edit]'))
          el.appendChild(a)
       })
    })();
    

    Rodd thinks there are probably more elegant ways to do this, but it works. We look for posts with dates that contain a link, pull out the post ID with a regular expression, and add in a new appropriate “[Edit]” link. It works great, and it’s going to make my daily blog cleanup a lot faster!

    A screenshot of web-goddess.org showing an [Edit] link next to the post date

    If you know of how to edit the Twenty Twenty-Five child theme to include this, please let me know as I’d love to know how it’s actually meant to be done…


  • I don’t have spotify

    Super useful “translator” for Spotify links to open in other music players. (Last November I cancelled my Spotify subscription and switched to Apple Music.) Seems to work fairly well on generic things like albums and artists, though obviously not for playlists that are only available on Spotify. (Link courtesy of kottke.)


  • Library events

    As luck would have it, I’m booked in for several interesting library and literacy-related events here in Sydney later this month:

    Let me know if you’re going to any of these!


  • Buttered, Chippendale

    A woman in glasses in front of a bakery counter

    I saw on my RSS feed last week that a new trendy Korean bakery called Buttered was opening soon at the Central Park brewery development. This morning I saw a review on Not Quite Nigella that tipped me off that it had soft-launched. What better excuse for an afternoon walk to check it out?

    A man peers through a window into an empty bakery kitchen

    It was a Thursday afternoon, and the place was fairly empty. I didn’t see any of the viral tissue bread, but they still had a selection of their “SaltyBoi” salt breads. We picked up a plain and a corn cheese to go, opting to heat them up in the oven at home.

    A plain salt bread, which looks like a fat croissant crossed with a dinner roll

    Rodd opted for the plain salt bread, which looks like a croissant crossed with a dinner roll. It was very buttery, so buttery that he decided to take a Lactaid after the first bite.

    A view inside a salt bread, showing a hole where the butter melted

    Inside was a hole which must have been where the butter sat before it melted. He found it very tasty and thought it would make a great breakfast roll.

    A corn cheese salt bread, which is a football shaped bread roll split down the middle and filled with melted cheese and sweetcorn

    On the basis of the NQN recommendation, I went with the corn cheese salt bread. I’ve had corn cheese at Korean restaurants before and figured I’d like this.

    A half-eaten corn cheese salt bread, showing an interior filled with melted cheese and sweet corn

    It was wonderful! I’m a person that loves a crispy/chewy bread crust, so these SaltyBois are perfect. They have loads of crunch but don’t shatter everywhere like a croissant. The inside was soft and loaded with gooey sweet corn cheese. Really yummy.

    Buttered definitely seems like it’s worth another visit. We’ll have to go back and get the tissue bread one of these days…


  • Mi goreng

    While I was away, the Snook decided to level up his mi goreng. All the plastic packets in the prepackaged version bothered him, so he bought all the components to make it from scratch: kecap manis, chili crisp, sambal badjak, Maggi seasoning, sesame oil, chicken stock powder, plain noodles, and fried shallots. He just made it for our lunch garnished with prawns, peas, green onions, and a fried egg. 😍

    Mi goreng


  • Book reviews 📖

    My book reading has really ramped up of late. Here are four more that I recently finished over the past few months:

    • Gilead by Marilynne Robinson – It was beautifully written, and I understand why it won so many awards—but I wouldn’t say I enjoyed it. I don’t normally choose to read books that deal so heavily with religion. It felt like a book I’d have been assigned in college, and like the ones I read back then, I suspect a lot of it went right over my heathen head.
    • The Kaiju Preservation Society by John Scalzi – My first ever Scalzi, despite “knowing” him from Metafilter and social media for years. Basically a fun action movie, sort of the opposite of Gilead. This was loads of plot and world building, and it didn’t matter so much that I could barely tell the characters apart. A nice palate cleanser!
    • Circe by Madeline Miller – Ohmygosh, I absolutely loved this and devoured it. It reminded me in a way of The Mists of Avalon, the sense of centering and humanising a female character who had been reduced to a one-dimensional evil sorceress in the original texts. I actually had to stop myself from reading the ending on the flight to my grandmother’s funeral, because I knew it was going to wreck me and I wasn’t in the right mindset for it. It’s so good. It actually inspired me to start reading a translation of The Iliad and to request Miller’s Song of Achilles book from the library.
    • All Systems Red (The Murderbot Diaries, #1) by Martha Wells – Not gonna lie, I picked this one up because of the upcoming show with Skargård. Thankfully it’s pretty good! I blasted through it in my single day of travel chaos, and it kept me from getting too stressed waiting in airports and on runways. The story is pretty simple and straightforward, but the world building is well done and the plot well-paced. The ending surprised me a bit, so I’m excited to see where the series goes. Already requested the second one!

    If you want to friend me on Goodreads, my profile is here.


  • Links that have interested me lately


  • Travel woes

    [tl;dr long post about air travel drama]

    A woman in glasses, sniffling into a purple handkerchiefMy excited plane selfie turned out to be misplaced optimism. We sat on the runway in Fort Wayne for some time before the United pilot announced there was a mechanical issue and we would be heading back to the gate. Except—more omens and portents—the ground staff had already clocked off for the day so we had to wait for half an hour to be able to deplane. This is when I knew that I had a big problem. I had about 9hrs to get to LA before my Qantas flight to Sydney at 11:10pm. Seems doable, right? But here’s the catch – I was travelling on separate tickets. Because of the flurry to get there in time for the funeral, I’d booked the Qantas flight to LA separately from the two domestic United flights back to Indiana. This was a mistake. If United didn’t get me there in time, I’d miss my Qantas flight… and I’d already just paid an extra $1600 for a business class upgrade. 😩

    So then it was just endless queues and waiting and uncertainty and slow computers and clueless staff. United’s system rebooked me going from Fort Wayne -> Chicago -> San Francisco -> LA, arriving well after midnight and completely missing the Qantas connection. Luckily when we deplaned I managed to get 2nd in the desk queue, and I explained my predicament to the gate agent. I probably spent 25 minutes with her as she sat on hold (with her own company! while standing in front of a computer terminal! and she was the supervisor!!) trying to rebook me onto an earlier 5:55pm direct flight from Chicago -> LAX. She was successful in the end, but it was still completely dependent on our plane in Fort Wayne getting fixed and getting us to Chicago in time. (All other flights to Chicago were already full, so it was either that plane or nothing.) The estimated departure time kept slipping more and more. Now I was getting really nervous. I decided to call Qantas to find out what my options were for moving the international flight.

    Sadly, Qantas were not helpful. The lady I was on with put me on hold for a long time, and ultimately she told me that I could change the flight, but I’d forfeit the $1600 upgrade fee. What?! I went back and forth with her for 40min trying to find a solution, before I ran out of minutes on my e-sim and the call cut off. Not good. I still had Internet, but no phone… and there was now a long queue of angry customers at the desk. I could buy more minutes, but I was worried that the plane would start boarding while I was still on hold with an agent. I needed help, which meant messaging my Mom to call Rodd back in Australia to wake him up. He immediately set to work getting me on the next best flight out of Chicago, which would get me to LA a mere 75min before the Sydney flight. He managed to get me on it—I think I got the very last seat!—but I would have to deplane, collect my suitcase, and drop it with Qantas… and they close bag-drop 60min before the flight. It seemed very unlikely that I’d make it. Rodd was even investigating “VIP meet-and-greet options,” where they meet you on the tarmac with a car to whisk you through a private entrance. (That was like $1000 though – yeah, no.) Our other option was getting my sister or someone at the airport to pick up the suitcase and ship it on to me in Australia. That’s assuming, of course, that my suitcase even made it to LA given that I now had a tight connection in Chicago. I had to fight my way back to the desk to get the agent to retag my suitcase—for the 3rd time—to be on the new LA flight. And then, miracle of miracles, we actually got on the plane and flew to Chicago. It was first time in my life I’ve ever applauded when a plane took off.

    When we landed in Chicago, I found out that my flight to LA had been delayed 15 minutes, thus erasing my tiny buffer and whatever slim chance I had of making the Qantas flight. We would have to move it, and I was going to lose my lovely business class seat. Rodd worked on that while I raced through O’Hare to my gate, all the while checking the app to see if my luggage actually made it onto the next plane. As I was standing in the queue to board, he messaged me that Qantas were moving me to the next day, they would refund my upgrade fee, and the whole mess was only going to cost me like $250. The app then updated to let me know my luggage had made it onto the plane to LA, and my sister confirmed that she would pick me up when I landed. I honestly teared up a little bit.

    Six hours later I was in bed at my sister’s house, safe and sound with everything sorted out. I realise this was all such a first world problem. I was never in physical danger; it was just stress and hassle and uncertainty. I’ll get home a day later than intended, but I also get an extra day to spend with my nieces. The whole misadventure didn’t cost me much in the end, though I am still slightly bitter about missing out on my business class seat. (I’m not going to bother to upgrade again. That feels like tempting fate.) I am incredibly grateful to Rodd for keeping a cool head and working the phones while I was spinning out. I’m grateful to my Mom for providing emotional support throughout the day, and to my sister and her family for welcoming me back on short notice.

    But man, I will be so glad to get home… ❤️


  • Flight 1

    Time to go home! Little puddle jumper to start… ✈️

    Flight 1


  • Congrats, Prime Minister Albanese

    An older lady asked me yesterday what my favourite thing about living in Australia is. My strong temptation* was to say “A functional democracy.” 🙃 Mandatory voting; preferential voting; voting on Saturday; voting on paper with pencils; democracy sausages – it’s all wonderful. Last week when I was scrambling to get packed and catch my flight to the funeral, I ducked into an early voting place to cast my vote. I was in and out in < 5 minutes. And today I was delighted to wake up and see the outcome, an utter rejection of Trumpism… THANK YOU, MY FELLOW AUSSIES! ❤️🇦🇺

    * I didn’t say that, of course. I’m in Indiana. I just mumbled something about preferring it there.



ABOUT

My name is Kris. I’ve been blogging since the 90’s. I live in Sydney, Australia, and I spent most of my career in the tech industry.

No AI used in writing this blog, ever. 100% human-generated.


search


CURRENTLY LISTENING


CURRENTLY READING


LATEST COMMENTS

  1. Woot, my knee-jerk don’t-overthink-it pub-quiz answer was Iran which seems to be [✓]. I ‘knew’ it was more populous than…

  2. My home economics teacher taught us to use “J cloths” as press cloths. (Cellulose cleaning cloths). The upside of using…


BLOG ROLL


STAY CONNECTED


Special thanks to Matt Hinrichs for the site logo!