Closed Fabrunet closed 8 years ago
I think this has to do with Custom Statuses on posts not showing up in relationship fields, since Orders wouldn't exactly be 'published'.
@jimtrue you were right. I manually edited the status for 'publish' in the database and the order is now showing up in relationship field.
Is there a simple way to force Pods to consider other post statuses?
Hi,
I have same version and i have also empy field list.
@Fabrunet Nope, there's not. That's why I figured this might be the issue. You confirmed my suspicions, so this will go straight to a bug/compatibility issue for handling. @sc0ttkclark This one sounds familiar (the need for managing multiple post statuses for relationship fields). Wasn't this similar to the #3451 issue?
This filter should work for this:
pods_api_get_table_info_default_post_status
Example:
/**
* Default Post Status to query for.
*
* Use to change "default" post status from publish to any other status or statuses.
*
* @param array $post_status List of post statuses. Default is 'publish'
* @param string $post_type Post type of current object
* @param array $info Array of information about the object.
* @param string $object Type of object
* @param string $name Name of pod to load
* @param array $pod Array with Pod information. Result of PodsAPI::load_pod()
* @param array $field Array with field information
*
* @since unknown
*/
add_filter( pods_api_get_table_info_default_post_status, 'my_theme_get_table_info_default_post_status', 10, 8 );
function my_theme_get_table_info_default_post_status( $post_status, $post_type, $info, $object_type, $object, $name, $pod, $field ) {
// (optional) filter by post type
if ( $post_type == 'shop_order' ) {
// Full list of WooCommerce post statusses: http://woocommerce.wp-a2z.org/oik_api/wc_get_order_statuses/
$post_status[] = 'wc-completed';
}
return $post_status;
}
@sc0ttkclark Maybe add this to the field options UI? >> (https://codex.wordpress.org/Function_Reference/get_post_stati)
Fixed in #3626
I created a 'Folder' pod, with a field 'Associated order' to display linked WooCommerce orders.
I extended the shop_order post type to add a Relationship field type, related to 'Folder'.
So 'Folders' and 'Orders' are now linked
Issue: when I edit a 'Folder', I can see the associated orders in the 'Custom fields' panel, but the 'More fields' is blank.
I have the latest versions of Wordpress (4.5.3), Pods (2.6.5.2) and WooCommerce (2.6.1). Local environnement, MAMP.