Gutenberg Custom Block Getting All Posts
In addition to loading the wp-api script as mentioned here: wp_enqueue_script( ‘wp-api’ ); // or use below when enqueueing as dependency //wp_enqueue_script( ‘my_script’, ‘path/to/my/script’, array( ‘wp-api’ ) ); You should also know that each collection is a function (equivalent to a class in PHP), so you need to use the new keyword to instantiate a … Read more