I'm working with the latest Gutenberg and WP and until last week, the code below worked as expected.
const postSelections = [];
const allPosts = wp.apiFetch({path: "/wp/v2/featured-post"}).then(fps => {
postSelections.push({label: "Select a Post", value: 0});
$.each( fps, function( key, val ) {
postSelections.push({label: val.title.rendered, value: val.id});
});
return postSelections;
});
All of a sudden I'm getting wp.apiFetch is not a function errors.
Anyone have any idea why??
wp-api-fetch
dependency in your script.'wp-api-fetch'
and it should not throw the error.