Getting the post ID from a WordPress content on an external site

In case you need to get the post/page/{$custom_type} ID from a WordPress content, from a remote site or no direct access to the database, here’s an easy and reliable way to do it.

When you make a request to a WordPress site for a “singular” content (that is, the detailed view of a single post, whatever type it is), you should receive a Link HTTP header that uses the database ID of the content, something like:

Link: <{$POST_ID}; rel=shortlink

From then on, you can extract the {$POST_ID} param from the URL using your favourite technique.

If you do have access to the database, you might want to check this post: How to Get Post and Page IDs in WordPress.

Design principles for the web

When I first read the title “Design principles for the web” I thought this was going to be yet another post about web design trends… fortunately I was completely wrong.

On this article (there’s also a video) Jeremy Keith takes us from detecting bias in analytics to design methodologies to a discussion of the conceptual foundations of the web and the deep contrasts with today’s over-engineering trends of trying to bend and control the user experience even at the expense of universality/ubiquity — in the words of Eric Meyer, “the web does not value consistency. The web values ubiquity”.

Copying theme mods to child theme using wp-cli

“Child themes” in WordPress allow for specific modifications of the look and functionality of those inherited from their “parent” theme.

Unfortunately, when you switch to the child theme, the customizations configured on the parent theme are lost, because they’re saved with the active theme slug.

So, here’s a quick and simple way to “inherit” those settings by copying those options to the child theme.

Using wp-cli:

wp option get theme_mods_PARENT-THEME --format=json | wp option add theme_mods_CHILD-THEME --format=json

… where PARENT-THEME and CHILD-THEME are the theme slugs for each theme.

Digital manors and warlords

On Neofeudalism and the Digital Manor, Cory Doctorow compares Apple, Microsoft, Google to warlords willing to defend your digital security… unless they’re compelled to turn on you by a government power, which, it turns out, happens quite a lot. A good reminder that all that sensitive information that they’re collecting on you, can and will be used against you, just as that seemingly well-intentioned control over your device will be abused.