Headless WordPress and Modern Development Flashcards
(25 cards)
What is a headless WordPress setup?
Headless WordPress uses WordPress as a backend CMS, delivering content via APIs to a separate frontend.
In a headless setup, WordPress manages content, while a frontend (e.g., React) handles display, connected via the REST API or GraphQL. Freelancers use it for modern, flexible client sites, while enterprise architects leverage it for scalable, decoupled architectures.
What is the benefit of headless WordPress?
It offers flexibility, scalability, and the ability to use modern frontend frameworks.
Decoupling allows developers to use React, Vue.js, or Next.js for dynamic interfaces, improving performance and UX. Freelancers deliver cutting-edge sites, while enterprise architects use it for modular, cross-platform systems.
How does the WordPress REST API support headless setups?
The REST API delivers WordPress content as JSON to frontends.
Endpoints like /wp-json/wp/v2/posts provide posts, pages, or custom data. Freelancers use it for client apps, while enterprise architects integrate it with enterprise systems for content delivery.
What is GraphQL in the context of headless WordPress?
GraphQL is an API query language for precise, flexible data retrieval from WordPress.
Unlike REST, GraphQL allows clients to request only needed data, reducing over-fetching. Freelancers use it for efficient client projects, while enterprise architects leverage it for optimized, scalable data access.
What is the WPGraphQL plugin?
WPGraphQL provides a GraphQL interface for querying WordPress data.
It enables queries like { posts { nodes { title } } } for specific data. Freelancers use it for headless client sites, while enterprise architects integrate it with modern frontends for enterprise applications.
What is a headless frontend framework?
A frontend framework (e.g., React, Vue.js) renders the UI in a headless WordPress setup.
Frameworks fetch data from WordPress APIs and handle presentation. Freelancers build dynamic client interfaces, while enterprise architects use them for scalable, high-performance UIs.
What is Next.js in headless WordPress?
Next.js is a React framework used for server-side rendering and static site generation with WordPress APIs.
It fetches data from WordPress APIs for fast, SEO-friendly sites. Freelancers use Next.js for client projects, while enterprise architects leverage it for scalable, enterprise-grade frontends.
What is Gatsby in headless WordPress?
Answer: Gatsby is a static site generator that uses WordPress APIs to build fast, static sites.
Gatsby pulls data via GraphQL (e.g., WPGraphQL) to generate static HTML. Freelancers create performant client sites, while enterprise architects use it for scalable, low-maintenance solutions.
What is server-side rendering (SSR) in headless WordPress?
SSR renders pages on the server before sending them to the client, using frameworks like Next.js.
SSR improves SEO and initial load times by pre-rendering content. Freelancers use it for client UX, while enterprise architects implement it for high-traffic, SEO-critical systems.
What is static site generation (SSG) in headless WordPress?
SSG pre-builds static HTML files at build time, using tools like Gatsby. Explanation: SSG fetches WordPress data via APIs to create fast, secure sites. Freelancers use it for low-maintenance client sites, while enterprise architects leverage it for scalable, static deployments.
What is the role of register_rest_route() in headless WordPress?
register_rest_route() creates custom REST API endpoints for headless frontends.
For example, register_rest_route(‘myapi/v1’, ‘/data’, array(‘methods’ => ‘GET’, ‘callback’ => ‘my_callback’)) serves custom data. Freelancers build endpoints for client needs, while enterprise architects create scalable APIs.
How do you secure headless WordPress APIs?
Use authentication (e.g., JWT, OAuth), HTTPS, and permissions callbacks.
Secure APIs with permission_callback in register_rest_route() and plugins like JWT Authentication. Freelancers secure client APIs, while enterprise architects enforce enterprise-grade security.
What is JWT authentication in headless WordPress?
JWT (JSON Web Token) authentication secures REST API access with tokens.
Plugins like WP JWT Authentication generate tokens for users. Freelancers use it for secure client apps, while enterprise architects integrate it with SSO for enterprise systems.
What is the wp_headless plugin?
There is no specific wp_headless plugin; headless setups use plugins like WPGraphQL or REST API extensions.
These plugins enable API-driven content delivery. Freelancers configure them for client projects, while enterprise architects use them for decoupled architectures.
What is a custom post type in headless WordPress?
A custom post type is a user-defined content type exposed via APIs for headless frontends.
Registered with register_post_type(), it’s accessible via /wp-json/wp/v2/my_post_type. Freelancers create them for client content, while enterprise architects model data for enterprise systems.
What is a custom taxonomy in headless WordPress?
A custom taxonomy organizes content and is exposed via APIs for headless use.
Created with register_taxonomy(), it’s accessible via endpoints like /wp-json/wp/v2/my_taxonomy. Freelancers use it for client organization, while enterprise architects structure complex data.
What is the Advanced Custom Fields (ACF) plugin in headless WordPress?
ACF creates custom fields that can be exposed via REST or GraphQL APIs.
The ACF to REST API or WPGraphQL ACF plugins make fields available. Freelancers use ACF for client flexibility, while enterprise architects integrate custom fields into data models.
What is the role of webhooks in headless WordPress?
Webhooks send real-time data to external systems when WordPress events occur.
For example, a webhook notifies a frontend on post updates. Freelancers set up webhooks for client sync, while enterprise architects use them for real-time system integration.
How do you create a webhook in headless WordPress?
Use wp_remote_post() with action hooks to send data on events.
For example, add_action(‘save_post’, ‘send_webhook’) triggers a webhook. Freelancers build webhooks for clients, while enterprise architects ensure reliable data delivery.
What is the role of the Transients API in headless WordPress?
The Transients API caches API data to reduce requests and improve performance.
Using set_transient() and get_transient(), it caches frontend data. Freelancers optimize client sites, while enterprise architects pair it with Memcached for scalability.
What is a headless CMS architecture?
A headless CMS architecture decouples content management (backend) from presentation (frontend).
WordPress serves as the backend, delivering data via APIs to any frontend. Freelancers use it for flexible client solutions, while enterprise architects design modular, scalable systems.
What is the role of React in headless WordPress?
React builds dynamic, interactive frontends that consume WordPress API data.
React fetches data via REST or GraphQL for responsive UIs. Freelancers create modern client interfaces, while enterprise architects use React for scalable, high-performance frontends.
What is the role of Vue.js in headless WordPress?
Vue.js builds lightweight, reactive frontends for WordPress API data.
Vue.js integrates with APIs for dynamic interfaces. Freelancers use it for client projects, while enterprise architects leverage its simplicity for enterprise-grade UIs.
What is incremental static regeneration (ISR)?
ISR updates static pages incrementally without rebuilding the entire site.
Supported by Next.js, ISR revalidates pages using WordPress APIs. Freelancers use it for fast client sites, while enterprise architects implement it for scalable, dynamic static sites.