2026年11月12日
2026年11月12日
How to Use Pods for Custom Post Types and Fields: Setup to WP-CLI
This article is a localized edition of the Japanese original. Read the Japanese original
Pods (full name "Pods – Custom Content Types and Fields") is a free plugin that adds custom post types, custom taxonomies and custom fields to WordPress. You can register post types and create fields in a single plugin, and it also includes templates and blocks for displaying the data you create.
As of October 2026, the latest version is 3.3.9.2, and it requires WordPress 6.3 or later and PHP 7.2 or later (100,000+ active installs). This article walks through creating and displaying content using the example of a "Book" post type with "ISBN" and "Price" fields. The screens were checked with WordPress 7.1.4 and Pods 3.3.9.2. Parts of the Pods admin are not translated in every language (including Japanese), so this article uses the English labels as they appear in the plugin.
What Pods can do
In Pods, each container you manage is called a "Pod". These are the kinds of Pods (content types) you can create:
| Kind | What it is |
|---|---|
| Custom post type | A new post type with its own list and edit screens, like Posts or Pages |
| Custom taxonomy | A classification like Categories or Tags |
| Custom settings page | A settings screen that stores site-wide values (a phone number, for example) |
| Advanced Content Type | Data stored in its own table, separate from WordPress posts. Available after you enable it under "Components" |
You can also "extend" existing Posts, Pages, Categories, Users, Media and Comments by adding fields to them.
Installation
In the admin, go to "Plugins" → "Add New Plugin", search for "Pods", then install and activate "Pods – Custom Content Types and Fields".
With WP-CLI, use the following. The plugin slug is pods.
wp plugin install pods --activate
Once activated, a "Pods Admin" item is added to the admin menu.
Create a custom post type
- Open "Pods Admin" → "Add New"
- Choose "Create a new Content Type"
- Under "Content Type", select "Custom Post Type (like Posts or Pages)"
- Enter
Bookfor "Singular Label" andBooksfor "Plural Label" - If site visitors should see this content, select "Yes, make this content available for Dynamic Features in Pods and WordPress" under "Content Privacy"
- Open "Advanced" and set "Pod Name" (the post type name; lowercase letters and underscores) to
book - Click "Next Step". The Pod is created and its edit screen opens
The "Content Privacy" option in step 5 is not selected by default. If you leave it that way, the post type isn't treated as public, and visitors won't see its single pages or the shortcode output described later (administrators see a "Pods Access Rights: Admin-only Notice" message instead). To change it later, turn on "Publicly Queryable" in the "Advanced Options" tab of the Pod's edit screen and save.
The "Pod Name" is used as the post type name in URLs and in the database, so don't change it after you've added content.
Add fields
Add fields on the Pod's edit screen.
- Click "Add Field"
- Enter
ISBNas the label (the name shown on screen) andisbnas the name (the name used in code) - Under "Field Type", choose "Plain Text" and save
- In the same way, add a field with the label
Price, the namepriceand the field type "Plain Number" (shown as "整数", "integer", in the Japanese admin) - Click "Save Pod" to save the Pod
The main field types are:
| Field type | Example uses |
|---|---|
| Text (Plain Text, Website, Phone, E-mail, Password) | A single line of text, a URL, a phone number, an email address |
| Paragraph (Plain Paragraph Text, WYSIWYG (Visual Editor), Code (Syntax Highlighting)) | Multi-line text, formatted text |
| Date and time (Date / Time, Date, Time) | Event dates and similar |
| Number (Plain Number, Currency) | Quantities, amounts |
| File (File / Image / Video), oEmbed | Images, PDFs, YouTube and other embeds |
| Relationship | Links to other posts, users, taxonomies and so on |
| Yes / No, Color Picker | On/off values, colors |
After saving, a "Books" item appears in the menu, and you can add and edit books just like posts. The ISBN and Price inputs you added appear below the editor.
Storage types (meta-based and table-based)
With the default "Meta Based (WP Default)" storage, a custom post type Pod saves field values as standard WordPress custom fields (in the wp_postmeta table). That means you can read the values with get_post_meta() without using any Pods functions.
<?php
// With a meta-based Pod, standard WordPress functions can read the values too
$isbn = get_post_meta( get_the_ID(), 'isbn', true );
If you choose "Table Based", field values are stored in a dedicated table for each Pod. Advanced Content Types and table-based storage are disabled by default; enable "Advanced Content Types" and "Table Storage" under "Pods Admin" → "Components" to use them. Consider them when you have a lot of data and filtering by fields becomes slow. If in doubt, use meta-based storage, which works with other plugins and themes.
Display fields in templates (PHP)
Show fields on single pages
In a classic theme, single pages for the book post type use single-book.php. Inside the loop, use the pods() function to output field values.
<?php
// Inside the loop in single-book.php, output the fields of the current book
$book = pods( 'book', get_the_ID() );
?>
<p>ISBN: <?php echo esc_html( $book->field( 'isbn' ) ); ?></p>
<p>Price: <?php echo esc_html( $book->display( 'price' ) ); ?> yen</p>
pods( 'pod_name', post_id )fetches the data for one itemfield()returns the stored value as is, whiledisplay()returns a value formatted according to the field settings. In this example, a price of3300is3300withfield()and3,300withdisplay()- Escape values with
esc_html()or similar when you output them
List items that match conditions
Pass conditions to pods() to fetch multiple items, then use fetch() to step through them one at a time.
<?php
// Show up to 10 books priced at 2,500 yen or more, newest first
$books = pods(
'book',
array(
'limit' => 10,
'orderby' => 't.post_date DESC',
'where' => 'price.meta_value + 0 >= 2500',
)
);
if ( 0 < $books->total() ) {
echo '<ul class="book-list">';
while ( $books->fetch() ) {
printf(
'<li><a href="%1$s">%2$s</a> (ISBN: %3$s, %4$s yen)</li>',
esc_url( get_permalink( $books->id() ) ),
esc_html( $books->field( 'post_title' ) ),
esc_html( $books->field( 'isbn' ) ),
esc_html( $books->display( 'price' ) )
);
}
echo '</ul>';
}
whereandorderbyare used as parts of the SQL query.t.refers to the posts table, andprice.meta_valueis the value of the meta-basedpricefield (meta values are strings, so+ 0makes them compare as numbers)- Never put unvalidated input, such as form values, into
where. It can lead to SQL injection total()returns the number of items fetched in this query, andid()returns the current item's ID
The output of both code examples was confirmed with Pods 3.3.9.2.
Display with Pod Templates and a shortcode
To display content without writing PHP, use Pods' "Templates" component (enabled by default).
- Under "Pods Admin" → "Pod Templates", create a new template named
book-list - In the content, write what to show for one item using
{@field_name}placeholders (magic tags). For example:
<li>{@post_title} (ISBN: {@isbn}, {@price} yen)</li>
After publishing the template, place a shortcode on the page where you want the list. In the block editor, enter the following in a "Shortcode" block.
[pods name="book" template="book-list" limit="10"]
The {@price} magic tag outputs the formatted value (for example, 3,300), the same as display(). Note that writing an SQL expression in the shortcode's orderby can trigger the error "ORDER BY contains SQL that is not allowed" for security reasons. For fine-grained sorting, use the PHP from the previous section.
In the block editor and the Site Editor, you can also display lists or single items with the blocks Pods adds, such as "Pods Item List", "Pods Single Item" and "Pods Field Value".
Create Pods and fields with WP-CLI
Pods includes WP-CLI commands (wp pods), so you can create Pods and fields without the admin screens. The following steps were confirmed with Pods 3.3.9.2.
# Create a custom post type Pod
wp pods pod add --type=post_type --name=book --label=Books --label_singular=Book
# Create a group to hold the fields (note the "id" value in the output)
wp pods group add --pod=book --name=book_info --label="Book details"
# Add ISBN (text) and Price (number) fields to the group (--group_id is the id above; 5 in this example)
wp pods field add --pod=book --group_id=5 --name=isbn --label=ISBN --type=text
wp pods field add --pod=book --group_id=5 --name=price --label=Price --type=number
- In our test environment, specifying the group by name (
--group=book_info) inwp pods field addcaused an error, so the group is specified by ID (--group_id) - A Pod created with the command is not public either, just like one created in the admin. To show it to visitors, turn on "Publicly Queryable" in the "Advanced Options" tab of the Pod's edit screen (or, from the command line,
wp pods pod update-by-slug book --args='{"publicly_queryable":"1"}') - Check the available options with
wp help pods pod addandwp help pods field add. Thewp pod createandwp pod updatecommands from an earlier version of this article don't exist
Things to watch out for
- Don't rename Pods or fields later: Existing data is stored under the old names, so it may stop showing up
- Don't reuse a post type name from another plugin: Registering a post type with the same name in Custom Post Type UI, ACF or similar causes conflicts
- Single pages return 404: If you get a 404 right after creating a post type, go to "Settings" → "Permalinks" and click "Save Changes" to refresh the permalink settings
- Back up before making changes: Deleting a Pod or changing its storage type affects existing data. Back up the database before you start
Summary
- Pods lets you create custom post types, taxonomies and fields in a single plugin
- Create a Pod under "Pods Admin" → "Add New", and add fields with "Add Field" on its edit screen
- To show the content to visitors, choose the public option under "Content Privacy"
- Display data with
field(),display()andfetch()frompods(), or with Pod Templates and a shortcode, or with the Pods blocks - You can also create Pods with WP-CLI using
wp pods pod add,wp pods group addandwp pods field add
Related articles:
- How to create a custom post type with Custom Post Type UI
- How to use Advanced Custom Fields (ACF) in WordPress
- How to register a custom post type in WordPress
Questions about WordPress? The publisher of this site is based in Japan and replies in Japanese. Contact (Japanese)