Data Fetching Node
The Data Fetching Node is a base node that fetches data from the WordPress database via a Next.js server action. It is not used directly in templates — other, more specific nodes extend it and implement the required fetch() method.
Every subclass of DataFetchingNode must implement fetch(), which is called by the editor at render time to retrieve data and make it available to child nodes via the ${} syntax in Template Text Nodes.
Built-in Data Fetching Nodes
The following concrete nodes ship with the WP Next Editor:
| Node | Description |
|---|---|
PostDataFetchingNode | Fetches a single post from wp_posts |
PostsDataFetchingNode | Fetches an array of posts from wp_posts |
UsersDataFetchingNode | Fetches users from wp_users |
TermsDataFetchingNode | Fetches taxonomy terms from wp_terms |
SettingsDataFetchingNode | Fetches site options from wp_options |
Configuring a Data Fetching Node
Data Fetching Nodes are configured in the Data tab of the Element section in the Left Nav. From there you can add a data fetching node to the template and configure its query parameters (for example, which post ID or post type to fetch).
Once data is fetched and cached, its fields become available for use in Template Text Nodes, Dynamic Attributes, and any other node that supports ${} syntax.
See Working with Dynamic Data for full details on defining data, querying with URL parameters, and binding data to nodes.