• Resolved GusRuss89

    (@gusruss89)


    In includes/content.php there are a few places where the plugin modifies the query to add it’s own pages into post__not_in.

    The implementation of this prevents theme developers from using post__not_in in templates as the plugin will overwrite anything we set in a WP_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.

Viewing 1 replies (of 1 total)
  • Plugin Author Andrew Lima

    (@andrewza)

    Hi @gusruss89,

    Thank you for getting in touch.

    This is great!

    You are able to do a Pull Request or create an issue on our GitHub repository over at – https://github.com/strangerstudios/paid-memberships-pro

    One of our developers will overlook it, approve and merge it or simply comment where the code needs improvement.

    We are always open and grateful to input such as yours to improve PMPro.

    Thanks so much, I have also pinged our lead developer to look over this for you.

Viewing 1 replies (of 1 total)

The topic ‘Bug + Suggested Fix – Plugin overwrites post__not_in query params’ is closed to new replies.