In multiple cases where I needed to search for some posts I specifically need to add the post type, otherwise there's no result. Which is an issue with WP itself afaik. For example:
{# doesn't work #}
{% for post in taxonomy.posts %}
{# ... #}
{% endfor %}
{# works #}
{% for post in taxonomy.posts.type('post_type') %}
{# ... #}
{% endfor %}
The problem with Rila appears when I try to add that post type, it can't merge with the default, which is set to any, as a string. I searched for a quick solution, which was type casting these strings as an array:
// trait-query-args.php - line 43
public function set( $key, $value, $merge = false ) {
if( ! $this->allow_augumentation() ) {
return false;
}
# Some properties expect arrays. Make sure to format values
if( in_array( $key, array( 'post__in', 'post__not_in', 'author__in' ) ) ) {
$value = (array) $value;
}
if( $merge && is_array( $value ) ) {
$current = isset( $this->args[ $key ] ) ? $this->args[ $key ] : array();
// here I added the (array) casting as a quick fix
$current = array_merge( (array) $current, $value );
$this->args[ $key ] = $current;
} else {
$this->args[ $key ] = $value;
}
return $this;
}
What do you think the proper solution to this problem?
In multiple cases where I needed to search for some posts I specifically need to add the post type, otherwise there's no result. Which is an issue with WP itself afaik. For example:
The problem with Rila appears when I try to add that post type, it can't merge with the default, which is set to
any
, as a string. I searched for a quick solution, which was type casting these strings as an array:What do you think the proper solution to this problem?