pfefferle / wordpress-webmention

A Webmention plugin for WordPress
https://wordpress.org/plugins/webmention/
MIT License
115 stars 32 forks source link

Fix #470 #471

Closed janboddez closed 2 months ago

janboddez commented 2 months ago

By reassigning $query, you break most that comes after.

Also, current( $query->query_vars['meta_query'] ) can return a string ... See the example in the docs, where current( $query->query_vars['meta_query'] ) would return 'AND':

$args = array(
    'meta_query' => array(
        'relation' => 'AND',
        array(
            'key' => 'featured',
            'value' => '1'
        ),
        array(
            'key' => 'buried',
            'value' => '1',
            'type' => 'numeric',
            'compare' => '!='
        )
    )
 );

But in general, $query, which is passed to the callback by reference, should not be reassigned.

pfefferle commented 2 months ago

Oh, seems that we both did that in parallel :)