We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 35182ff commit 41d8b4cCopy full SHA for 41d8b4c
wp-serverless-api.php
@@ -19,7 +19,7 @@ function compile_db(
19
$db_array = array();
20
21
foreach ($routes as $route) {
22
- $url = esc_url( home_url( '/' ) ) . 'wp-json/wp/v2/' . $route;
+ $url = 'https://demo.wp-api.org/wp-json/wp/v2/' . $route;
23
$jsonData = json_decode( file_get_contents($url) );
24
25
$db_array[$route] = (array) $jsonData;
@@ -55,4 +55,13 @@ function build_db()
55
save_db($db);
56
}
57
58
-add_action( 'save_post', 'build_db' );
+add_action( 'save_post', 'build_db' );
59
+
60
+/**
61
+ * Create JSON on Activation
62
+ */
63
+register_activation_hook( __FILE__, 'pluginprefix_install' );
64
+function pluginprefix_install()
65
+{
66
+ build_db();
67
+}
0 commit comments