Bug + Suggested Fix – Plugin overwrites post__not_in query params
-
In
includes/content.phpthere are a few places where the plugin modifies the query to add it’s own pages intopost__not_in.The implementation of this prevents theme developers from using
post__not_inin templates as the plugin will overwrite anything we set in aWP_Query.Suggested fix: merge the plugin pages array into the current value of
post__not_in.So line 148 and 150 become
$query->set( 'post__not_in', array_merge( $query->get( 'post__not_in' ), $pmpro_pages ) );and line 202 becomes
$query->set( 'post__not_in', array_merge( $query->get( 'post__not_in' ), $hidden_page_ids ) );I’m not 100% sure how save
array_merge()is here if the existing value is blank or if there are duplicate array indexes, but it seems to work fine for me.
The topic ‘Bug + Suggested Fix – Plugin overwrites post__not_in query params’ is closed to new replies.