@aslotta @timmse
Good afternoon.
Again a problem.
I can’t figure out how to do this?
There is a code to display, works fine:
add_filter( 'bricks/posts/query_vars', function( $query_vars, $settings, $element_id ) {
if ( $element_id == 'oxlnoh' ) { // e.g. oxlnoh
$query_vars['post_status'] = 'draft'; // e.g. completed
$query_vars['author'] = get_current_user_id();
}
return $query_vars;
}, 10, 3);
And it works only if the product status is visible visible (Catalog & Search)
But what about them?
catalog (Catalog only)
search (Search only)
hidden (nowhere)
it’s a pity that there was no answer, I found a solution, but, in my opinion, some kind of clumsy one.
1
Tried in different ways, but the loop should be empty, completely. That’s the only way it works, for some reason
2
add_filter( 'bricks/posts/query_vars', function( $query_vars, $settings, $element_id ) {
if ( $element_id == 'xkmrou' && is_user_logged_in() ) {
//$query_vars['post_type'] = 'product' ;
$query_vars['post_status'] = 'approved';
$query_vars['author'] = get_current_user_id();
$query_vars['tax_query'] = [
array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'hidden',
'operator' => 'EXISTS'
)
];
}
return $query_vars;
}, 10, 3 );
And only in this way it turns out to display what I need.
Accepts a string: One of ‘visible’, ‘catalog’, ‘search’, or ‘hidden’.