Posting a couple of quirks in WordPress, that I’m likely to forget how to deal with them.
wp-block-post-template-inline-css
When I migrated a WordPress blog from my local dev environment to a webhosting, certain CSS files were not included in the <head>
, for example wp-block-post-template-inline-css
. I couldn’t find out what was causing this, but in the WordPress support forum someone had the same issue and the solution was to delete the _transient_wp_core_block_css_files
entry from the wp_options
table in your WordPress database.
Get featured image of a blog post from REST API
If you want to fetch the featured image of a blog post, you will need to include _embed
as a search param in your REST call: curl https://example.com/wp-json/wp/v2/posts?_embed
. You will then be able to find the image nested in the response object: response_object._embedded['wp:featuredmedia']['0'].source_url
. By adding the following to your functions.php
you will get a fimg_url
field directly on response_object
:
(source)