I think it’s very fair to say we should all assume the worst with Facebook all the time now.
The reason that the rich were so rich, Vimes reasoned, was because they managed to spend less money.
Take boots, for example. He earned thirty-eight dollars a month plus allowances. A really good pair of leather boots cost fifty dollars. But an affordable pair of boots, which were sort of OK for a season or two and then leaked like hell when the cardboard gave out, cost about ten dollars. Those were the kind of boots Vimes always bought, and wore until the soles were so thin that he could tell where he was in Ankh-Morpork on a foggy night by the feel of the cobbles.
But the thing was that good boots lasted for years and years. A man who could afford fifty dollars had a pair of boots that’d still be keeping his feet dry in ten years’ time, while the poor man who could only afford cheap boots would have spent a hundred dollars on boots in the same time and would still have wet feet.
This was the Captain Samuel Vimes ‘Boots’ theory of socioeconomic unfairness.
I had the need to change the status on several hundred wordpress posts by a particular author, from “publish” to “pending” (more on this in a future post). This would have taken me hours to do through the frontend, so I figured I’d make my first serious use of WP-CLI, and script the job.
You can list posts using WP-CLI, and specify which columns to display, and even pass in basic filters, like so
wp post list --<column>=value --fields=ID,post_title,post_status,post_author. You can also update posts. By combining these with some shell scripting, big jobs can be done fairly easily.
Easily. Oh, the hubris. The problem I ran into was:
- The display column names are the names of the columns in the database, so to list the post author, you would refer to it as post_author.
- The filter column names are as they are referred to in WP_Query, not how they are named in the database.
I didn’t catch on to this distinction at first, and the number of rows I was returning was large enough it couldn’t display all of them in the terminal. Yes, I should have used
less to check. I should have done a lot of things, like take a backup first (
wp db export ~/export.sql), but that wouldn’t be as good a cautionary tale.
Long story short, I ran
wp post list --post_author=3 --fields=ID,post_title,post_status,post_author, saw only the results I expected because some rows were cut-off. When I fed this into a loop which would update the post_status, I ended up setting every post as pending.
wp post list --post_author=3 --format=ids \ | xargs -d ' ' -I % wp post update % --post_status=pending
The correct command should have been
wp post list --author=3 --format=ids \ | xargs -d ' ' -I % wp post update % --post_status=pending
Thankfully, having realised my mistake, I could make use of WP-CLI to fix it:
wp post list --author=2 --format=ids \ | xargs -d ' ' -I % wp post update % --post_status=publish
For everyone following along at home, my mistakes so-far were:
- Not reading the documentation fully
- Not taking a backup before altering a live site
- Not double-checking my test results before running the command “for real”
I’ve returned all of the wrongly-pended posts to “publish” status. I do still have an issue with Post-Kinds data being missing on most of these posts; I think this is due to some wierd interaction between WP-CLI and the plugin, but I can’t be sure. These posts (~60) I’m going to have to fix by hand — I consider it a reprimand for my earlier flippant approach!
Cross-posted to /en/wordpress.
I’ve noticed this issue as well recently – even when parsing known “good” sites.
Coincidentally, I was also having issues with services like IndieWeb.xyz parsing my own site, even though every parser and validator I threw at my site picked up the microformats without issue – including my local install of Parse This. In the end I tracked the issue to the WordFence for WordPress security plugin tagging the incoming request as a hostile bot and rate-limiting/blocking it in response. Infuriatingly, this was working fine for the previous few months. I’ve turned off WordFence and my site seems to get picked up properly now.
Following on from my last bookmark, it seems to be really simple to reactivate the built-in Links Manager for WordPress. Just add the following to your theme’s
/** * Re-enable the built-in Links manager */ add_filter( 'pre_option_link_manager_enabled', '__return_true' ); // Add Shortcode add_shortcode( 'links', 'wp_list_bookmarks' );
I haven’t checked to see if there are any “gotcha’s” with this, but it seems to work as expected. Once done, add the shortcode
[links] to a page, passing in any parameters as per wp_list_bookmarks().
If you are using self hosted WordPress you can have a small links directory running in no time. This uses the “Links” feature in WordPress that was never removed, just papered over.
I’m already doing a basic version of this with my Links Page, but that’s all hand-crafted. I’d forgotten all about the Links Manager that was built into WordPress, mainly because it was hidden away ages ago. Maybe I should switch over to using that…
Also bookmarked on IndieWeb.xyz.
I think on my site I’d always want a mention to look like a link, so a reader can identify it and choose to visit whoever I’m mentioning. But that’s part of the joy of IndieWeb — we’re free to implement the details to our own tastes. Chris wants his mentions to blend into the text of his site, and that’s a perfectly valid choice.
I can only agree on dropping “@” prefixes though. Those are clunky and completely unnecessary in environments outside of siloed social media. The only time I include one is if I know I’m syndicating a particular post to Twitter.
Also bookmarked on indieweb.xyz.
“Red sky at night…”
For two decades we've learned, we've laughed, we've cried, and sometimes we've gone wtf.
20 years is a long time on the web. When I was just starting out in the IT industry, the two major sources of news I’d use to keep up with things (outside of blogs) were Ars and The Register. It’s comforting to see both still going.
Before the internet was consolidated into centralized information silos, RSS imagined a better way to let users control their online personas.