You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary
When I try to display the permalink to the terms of a table-storage custom taxonomy using the Pods Item List block, the block errors and the page cannot be displayed.
Detail
I have a custom taxonomy that is configured with table storage. The taxonomy has an image associated with it but no additional fields, hence the dedicated table only contains the ID.
I want to create a page where I display a list of the terms in this taxonomy and each term is a link to the archive page for that term. To do so, I use the Pods Item List block and use the following custom template: <a href="{@permalink}">{@name}</a><br>
This works fine for the name but once the permalink magic tag is entered, the block goes into error.
Adding some debug, I found that the call to get_term_link() in Pods.php:field() returns a WP_Error object.
get_term_link() is called in Pods.php:field() as get_term_link( $this->id(), $this->pod_data['name'] ). This error gets created in get_term_link() because the term ID is passed in to $term as a string rather than an integer.
The fundamental difference appears to be that for a table-storage custom taxonomy, $this->data->row['id'] is populated with the ID as a string. In the meta-storage custom taxonomy, this field is not present.
Once I change the storage type from table to meta, the term ID is passed in to get_term_link() as an integer and the error no longer occurs. A little more digging shows that in Pods.php:field(), $this->data->row['id'] is populated with a string for a table-storage taxonomy while it is not present for a meta-storage taxonomy.
Version
2.9.13
Testing Instructions
1.1 Create a new custom taxonomy tableflag using table storage.
1.2 Add term tflag1 to the tableflag taxonomy.
1.3 Add term tflag1.1 to the tableflag taxonomy as a child of tflag1.
2.1 Create a new custom taxonomy metaflag using meta storage.
2.2 Add term mflag1 to the metaflag taxonomy.
2.3 Add term mflag1.1 to the metaflag taxonomy as a child of mflag1.
3.1 Enable the PHP debug log.
3.2 Create a new page and add the Pods Item List block.
3.3 Set POD NAME to metaflag.
3.4 Set TEMPLATE to "-Use Custom Template-".
3.5 Set CUSTOM TEMPLATE to: {@name} -- {@permalink}<br>
3.6 Observe that the block preview shows:
Description
Summary
When I try to display the permalink to the terms of a table-storage custom taxonomy using the Pods Item List block, the block errors and the page cannot be displayed.
Detail
I have a custom taxonomy that is configured with table storage. The taxonomy has an image associated with it but no additional fields, hence the dedicated table only contains the ID.
I want to create a page where I display a list of the terms in this taxonomy and each term is a link to the archive page for that term. To do so, I use the Pods Item List block and use the following custom template:
<a href="{@permalink}">{@name}</a><br>
This works fine for the name but once the permalink magic tag is entered, the block goes into error.
Adding some debug, I found that the call to
get_term_link()
in Pods.php:field() returns a WP_Error object.get_term_link()
is called in Pods.php:field() asget_term_link( $this->id(), $this->pod_data['name'] )
. This error gets created inget_term_link()
because the term ID is passed in to$term
as a string rather than an integer.The fundamental difference appears to be that for a table-storage custom taxonomy,
$this->data->row['id']
is populated with the ID as a string. In the meta-storage custom taxonomy, this field is not present.Once I change the storage type from table to meta, the term ID is passed in to
get_term_link()
as an integer and the error no longer occurs. A little more digging shows that in Pods.php:field(),$this->data->row['id']
is populated with a string for a table-storage taxonomy while it is not present for a meta-storage taxonomy.Version
2.9.13
Testing Instructions
1.1 Create a new custom taxonomy tableflag using table storage.
1.2 Add term tflag1 to the tableflag taxonomy.
1.3 Add term tflag1.1 to the tableflag taxonomy as a child of tflag1.
2.1 Create a new custom taxonomy metaflag using meta storage.
2.2 Add term mflag1 to the metaflag taxonomy.
2.3 Add term mflag1.1 to the metaflag taxonomy as a child of mflag1.
3.1 Enable the PHP debug log.
3.2 Create a new page and add the Pods Item List block.
3.3 Set POD NAME to metaflag.
3.4 Set TEMPLATE to "-Use Custom Template-".
3.5 Set CUSTOM TEMPLATE to:
{@name} -- {@permalink}<br>
3.6 Observe that the block preview shows:
4.1 Change the POD NAME to tableflag.
4.2 Observe that the block preview updates to:
Error loading block: The response is not a valid JSON response.
5.1 View the PHP error log and find:
Screenshots / Screencast
No response
Possible Workaround
This problem no longer occurs once I change the taxonomy to use meta-storage.
Site Health Information
The text was updated successfully, but these errors were encountered: