When it comes to find() notation, there are many useful options built into Pods. These work for the where, having, groupby, orderby, and select parameters of find(), the Pods Shortcode, and the Pods Item List Block.
Contents
Field Syntax Reference
Pods has field selection available in queries enabled by the aliases that it sets up based on the context of each pod.
The “t” prefix is the one that Pods relies on most. It will always alias on the primary table of the current pod, like “wp_posts” or “wp_terms”.
Other syntax depends on whether your Pod is using meta-based or table-based storage.
| Notation | Description |
t.* | This syntax is used to reference the primary table. The alias “t” will automatically point at whichever table is set for the current pod. |
my_custom_field.meta_value | Reference the custom field “my_custom_field” for a Pod with meta-based storage. See the Relationship/File traversal information further below for relationship/file fields. You don’t need to define a custom field in Pods to be able to reference it like this. |
d.my_custom_field | Reference the custom field “my_custom_field” for a Pod with table-based storage. See the Relationship/File traversal information further below for relationship/file fields. |
d.* | This syntax is used to reference the custom Pod table columns (stored as the “field_name” defined for each field) for Pods with table-based storage. If you are using an Advanced Content Type, you should always just use the “t” prefix. |
Post Type / Media Pod Reference
Check out the full database reference of the wp_posts table (represented as “t” here).
| Notation | Description |
t.ID | Reference the post ID. |
| Reference the post title. |
| Reference the post date. |
taxonomy_name.term_id | Reference the term ID for a built-in taxonomy connection. |
taxonomy_name.* | Reference any of the taxonomy fields for a built-in taxonomy connection. |
Taxonomy Pod Reference
Check out the full database reference of the wp_terms table (represented as “t” here) or the wp_term_taxonomy table (represented as “tt” here).
| Notation | Description |
t.term_id | Reference the term ID. |
| Reference the term name. |
| Reference the term description. |
User Pod Reference
Check out the full database reference of the wp_users table (represented as “t” here).
| Notation | Description |
t.ID | Reference the user ID. |
| Reference the user display name. |
Comment Pod Reference
Check out the full database reference of the wp_comments table (represented as “t” here).
| Notation | Description |
t.comment_ID | Reference the comment ID. |
| Reference the comment date. |
Relationship / File Field Traversal
You can traverse into any relationship or file field to get at information directly without having to write your own SQL JOINs.
| Notation | Description |
simple_relationship_field.meta_value | Reference the related ID from the field “my_simple_relationship_field” for a simple relationship on a Pod with meta-based storage. |
d.simple_relationship_field | Reference the related ID from the field “my_simple_relationship_field” for a simple relationship on a Pod with table-based storage. |
my_relationship_field.ID | Reference the related ID from the field “my_relationship_field”. |
my_file_field.ID | Reference the related ID from the field “my_file_field”. |
| You can traverse as many levels as you would like into relationship or file fields. |
| Get the value of a custom meta field (Pods with meta-based storage) on the related field. |
*.custom_table_field | Get the value of a custom table field (Pods with table-based storage) on the related field. |