$repeater_item_ids = toolset_get_related_posts(
Common::get_company_id(),
$this->get_quote_type_item_value( 'title_fees_group_slug' ), // must be 20 characters or fewer
'parent',
PHP_INT_MAX, // `-1` for unlimited does not work
0,
[ 'meta_key' => Toolset_Post::SORTORDER_META_KEY ], // phpcs:ignore
'post_id',
'other',
'meta_value_num'
);
Thank you for sharing this code snippet, but it doesn't provide the full context.
Can you please share temporary admin login details of the website where this code/custom plugin is in use? If its a localhost website, you can either put in on an online server or share its duplicator package.
( ref: https://toolset.com/faq/provide-supporters-copy-site/ )
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
During troubleshooting, I noticed that warnings and errors are generated when the company ID to get the related posts from, doesn't exists.
You can update the 'get_title_fees_item_ids' function in your plugin to include an empty check, before getting the related posts:
( file: /wp-content/plugins/tk-calc-closing-costs/src/Calc/Abstract_Calc.php )
private function get_title_fees_item_ids(): array {
if ( ! function_exists( 'toolset_get_related_posts' ) ) {
return [];
}
$company_id = Common::get_company_id();
if ( empty($company_id) ) {
return [];
}
$repeater_item_ids = toolset_get_related_posts(
$company_id,
$this->get_quote_type_item_value( 'title_fees_group_slug' ), // must be 20 characters or fewer
'parent',
PHP_INT_MAX, // `-1` for unlimited does not work
0,
[ 'meta_key' => Toolset_Post::SORTORDER_META_KEY ], // phpcs:ignore
'post_id',
'other',
'meta_value_num'
);
// Protect against boolean from an error.
if ( ! is_array( $repeater_item_ids ) ) {
$repeater_item_ids = [];
}
return $repeater_item_ids;
}