WordPress setup¶
To use WordPress as your CMS with Silex, you need to expose your content via a GraphQL API. This page walks you through the plugins and setup required.
You need a WordPress site you can edit. If you're testing locally, use a local WordPress installation or a staging site. The plugins below are free and widely used.
Installing required plugins¶
Log into your WordPress admin dashboard and go to Plugins > Add New.
Install these plugins:
- WPGraphQL (by Jason Bahl)
- Search for "WPGraphQL" and click Install Now
- Activate the plugin
-
Your GraphQL endpoint is now available at
https://yoursite.com/graphql -
Pods (by Pods Framework Team) — for custom fields and custom post types
- Search for "Pods" and install
- Activate it
- Pods handles both custom fields and custom post types in one plugin (no need for a separate CPT UI plugin)
-
Pods is 100% open source (GPL) and free
-
WPGraphQL for Pods — to expose Pods fields to the GraphQL API
- Install and activate
- This makes your Pods fields available in GraphQL queries
Creating custom fields with Pods¶
Once Pods is installed:
- Go to Pods Admin → Edit Pods in the WordPress admin
- Select an existing pod (e.g., Post) or create a new one
- Click Add Field
- Set the field name (e.g.,
featured_color) and choose a type (Plain Text, File / Image, Paragraph, etc.) - In the field settings, make sure Show in GraphQL is enabled
- Click Save Pod
Pods fields now appear in your GraphQL API under each post.
Common field types: - Plain Text — short text (title, name, single line) - Paragraph — longer text (description, bio) - File / Image — a single image (featured image, thumbnail) - File / Image (multiple) — multiple images - Relationship — link to other posts - Pick (Select) — dropdown menu - Yes/No — checkbox/boolean - Date / Time — calendar field for dates
Creating custom post types¶
If your content doesn't fit WordPress's default "Post" and "Page" types, create a custom post type with Pods:
- Go to Pods Admin → Add New
- Select Custom Post Type
- Enter the post type name (e.g.,
team_member) - Set the label (what appears in the admin, e.g., "Team Members")
- Make sure Show in GraphQL is checked in the pod settings
- Click Save Pod
The new post type now appears in WordPress and in GraphQL. You can add custom fields to it directly in the same pod definition.
Verifying the GraphQL endpoint¶
- Open your browser and go to
https://yoursite.com/graphql - You should see a GraphQL editor
- In the left panel, click the Schema icon (looks like a magnifying glass)
- Look for types like
Post,Page, or your custom post types (e.g.,TeamMember) - Click on a type to see its available fields
If you see your content types, the API is working.
Testing the API with a simple query¶
In the GraphQL editor:
Click the play button. You should get back a list of your 5 most recent posts with their titles and excerpts. This proves the API is returning real content.
If you created Pods fields, they'll appear in the schema once WPGraphQL for Pods is enabled. Query them directly:
Public vs. private content¶
By default, WPGraphQL respects WordPress permissions. If a post is set to "Private", it only appears in GraphQL if the user is logged in.
For a public site, make sure your content is published and set to public in WordPress. For authenticated access (e.g., a member-only site), you may need to add authentication headers when connecting from Silex.
Common issues¶
- "GraphQL endpoint not found" — Make sure WPGraphQL plugin is installed and activated.
- Custom fields don't appear in GraphQL — Install "WPGraphQL for Pods" and check that "Show in GraphQL" is enabled on each field in the pod settings (Pods Admin → Edit Pods → select the pod → check each field).
- Custom post types don't appear — Go to Pods Admin → Edit Pods, select the pod, and make sure "Show in GraphQL" is checked.
- Query returns empty results — Check WordPress permissions. Private posts only appear to logged-in users.
Using ACF instead¶
If you prefer ACF (Advanced Custom Fields) over Pods, the workflow is similar. Install ACF + WPGraphQL for ACF instead of Pods + WPGraphQL for Pods. Note that ACF Pro is a commercial plugin (~$99/year), while Pods is fully free and open source.
Learn more¶
- Connecting a data source — adding your WordPress GraphQL endpoint to Silex
- Binding data — displaying WordPress content on your pages
- How CMS works — understanding the data flow from API to canvas
- Pods docs — full Pods framework documentation
Quiz¶
Q1: You installed WPGraphQL but your GraphQL endpoint isn't accessible. What's the first thing to check?
- A) Restart your WordPress server
- B) Make sure the WPGraphQL plugin is activated
- C) Check that your domain has SSL (HTTPS)
Answer
B) Make sure the WPGraphQL plugin is activated — Just installing the plugin isn't enough; it must be activated. Go to Plugins and verify the status.
Q2: You want to add a "Featured Image" field to your blog posts. Which plugin do you use?
- A) Custom Post Type UI
- B) Pods
- C) WPGraphQL
Answer
B) Pods — Pods lets you define custom fields for posts and other content types. Go to Pods Admin → Edit Pods, select your pod, and add fields without coding.
Q3: You created a custom post type called "Portfolio Item" but it doesn't appear in GraphQL. What's the most likely issue?
- A) WPGraphQL isn't installed
- B) "Show in GraphQL" is not enabled on the custom post type
- C) You need to create custom fields for it first
Answer
B) "Show in GraphQL" is not enabled on the custom post type — When creating a custom post type with Pods, you must check the "Show in GraphQL" setting in the pod configuration for it to appear in your API.
Q4: You added a Pods field called featured_color to your posts. What plugin do you need to query it from GraphQL?
- A) WPGraphQL for Pods
- B) Custom Post Type UI
- C) Just Pods and WPGraphQL
Answer
A) WPGraphQL for Pods — This bridge plugin exposes Pods fields to the GraphQL API. Without it, Pods fields may not appear in GraphQL queries.