{"id":373952,"date":"2022-10-11T09:15:48","date_gmt":"2022-10-11T16:15:48","guid":{"rendered":"https:\/\/css-tricks.com\/?p=373952"},"modified":"2022-12-12T09:07:48","modified_gmt":"2022-12-12T17:07:48","slug":"rendering-external-api-data-in-wordpress-blocks-on-the-front-end","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/rendering-external-api-data-in-wordpress-blocks-on-the-front-end\/","title":{"rendered":"Rendering External API Data in WordPress Blocks on the Front End"},"content":{"rendered":"\n

There\u2019ve been some new tutorials popping here on CSS-Tricks for working with WordPress blocks. One of them<\/a> is an introduction to WordPress block development and it\u2019s a good place to learn what blocks are and to register them in WordPress for use in pages and posts.<\/p>\n\n\n\n

While the block basics are nicely covered in that post, I want to take it another step forward. You see, in that article, we learned the difference between rendering blocks in the back-end WordPress Block Editor and rendering them on the front-end theme. The example was a simple Pullquote Block that rendered different content and styles on each end.<\/p>\n\n\n\n

Let\u2019s go further and look at using dynamic content<\/strong> in a WordPress block. More specifically, let\u2019s fetch data from an external API and render it on the front end when a particular block is dropped into the Block Editor.<\/p>\n\n\n\n\n\n\n\n

This is part of a larger series where I want to cover all the points for working with external API data in a custom WordPress block.<\/p>\n\n\n\n

Working With External APIs in WordPress Blocks<\/h4>\n\n\n