Hi Minesh
I am really sorry you can't access the functions.php file via FTP. I am consulting with my 'server guy' to see what the problem is.
Also, FYI, I have since ran the Toolset Relationships table update which I had been reluctant to do since it made a little mess of another website I have... But on this site it seems to have updated fine. Certainly, I haven't found any problems yet.
In the meantime, I have dropped your code in for you, specifically this section:
$query = new WP_Query(
array(
'post_type' => 'ticket',
'fields'=>'ids',
'posts_per_page' => -1,
'meta_query' => array(
array('key' => 'wpcf-ff-post-status',
'compare' => '=',
'value' => '1'),
array('key' => '_stock_status',
'compare' => '=',
'value' => 'instock')
),
//new toolset_relationships query argument
'toolset_relationships' => array(
'role' => 'child',
'related_to' => $parent->ID,
// this will work only with relationships that have existed before the migration
// if possible, use the relationship slug instead of an array
'relationship' => $relationship_slug
),
)
);
$children = $query->posts;
But unfortunately it renders a 'critical error' as it did before.
Also, just to mention, if this new array idea is about working around the '<=' comparison versus '=' comparison then we can also use the _stock_status field instead if you like. So I reverted back to the previous format and tried this as follows:
$children = toolset_get_related_posts(
$parent->ID,
$relationship_slug,
'parent',
1000000,
0,
array(
array('meta_key' => 'wpcf-ff-post-status',
'meta_compare' => '=',
'meta_value' => '1'),
array('meta_key' => '_stock_status',
'meta_compare' => '=',
'meta_value' => 'instock')
),
'post_id',
'child'
);
But no... it doesn't work either. It doesn't seem to filter results by the second comparison. If I swap the order and put the _stock_status comparison first then it filters by that and not the wpcf-ff-post-status comparison.
What do you reckon? 🙂
Let me know how you would like to tweak it and I will pop it in for you quick as a flash. No problem.
Rita