Closed michaelbeil closed 6 years ago
Thanks for the report, @michaelbeil. I don't have a copy of AffiliateWP. I'll reach out to them to see if I can get a copy for debugging.
You can email me at michael @ affiliatewp dot com 😄
@michaelbeil Ha ha. OK.
Or just use our repo: https://github.com/affiliatewp/AffiliateWP
Hi @michaelbeil - Thanks for your patience as I found time to dig into this.
I am an AffiliateWP newbie, so I had to fill in the gaps in your steps to reproduce. I did manage to reproduce, once I had things set up.
The underlying problem here is that BuddyPress Docs has its own 'pre_get_posts' callback, which contains a WP_Query
call. Due to some oddities of the implementation of do_filters_ref_array()
etc, this meant that Affiliate_WP_Rewrites::unset_query_arg()
was not being run properly in these cases. Not really a bug in AffiliateWP or BuddyPress Docs - just a limitation in WP. I started to draft a long comment laying this out, but realized I would be better served by pointing you to https://core.trac.wordpress.org/ticket/17817 :)
The good news is that I believe this problem goes away with WP 4.7. To test, using the following code in a wp-plugin. It should demonstrate the bug in WP 4.6 but not in WP trunk. Can you verify?
function bbg_test_affwp( $q ) {
remove_action( 'pre_get_posts', 'bbg_test_affwp' );
$query = new WP_Query( array(
'post_type' => 'post',
'posts_per_page' => 1,
) );
wp_reset_query();
add_action( 'pre_get_posts', 'bbg_test_affwp' );
}
add_action( 'pre_get_posts', 'bbg_test_affwp' );
So a user found an issue that occurs when AffiliateWP and the BuddyPress docs plugin are active, causing a visit with a referral link to the home page (when a static page is set) to display the blog roll instead.
To replicate: