the_content filter causing plugin conflicts

Posted in

Hi there, we use Groups with the theme WPLMS. We were having a few errors in quiz reporting and some text fields on the site. narrowed it down to the Groups plugins and specifically the following line of code.


Line 102 add_filter( ‘the_content’, array( __CLASS__, ‘the_content’ ), 1 );

Commented this line out and everything works again.

Could you double check that this code is correct and if it is could you let us know what might be affected by commenting it out?


5 Responses to the_content filter causing plugin conflicts

  1. Lawrence August 9, 2017 at 11:06 pm #

    Ended up having to parse the URL to get something actionable. Hope this helps someone else!

    add_filter( ‘groups_post_access_the_content_apply’, ‘my_groups_post_access_the_content_apply’, 10, 2 );

    function my_groups_post_access_the_content_apply( $apply, $output ) {
    global $post;
    global $wp;
    $current_url = home_url(add_query_arg(array(),$wp->request));

    if (strpos($current_url, ‘course-results’) !== false) {
    $apply = false;
    return $apply;

    • Kento August 17, 2017 at 3:52 pm #

      Perfect, thanks for sharing that Lawrence!

  2. Lawrence July 31, 2017 at 2:54 pm #

    Thanks Kento, I had disabled protecting access to everything and still had the problem until I commented out that line. The error happens when submitting the quiz. the_content filter the data uploaded tot he database.

    I’ll see what I can do with the filter and post my results.

    • Kento August 2, 2017 at 6:19 am #

      Thanks Lawrence, yes please let me know how it turns out.

  3. Kento July 31, 2017 at 11:43 am #

    Hi Lawrence,

    By disabling this filter, you could expose protected content to those who should not be able to access it.

    There are two direct solutions, one is to simply disable protecting access to the quiz content, you can do that under Groups > Options (assuming a plugin or theme you mention creates a post type for the quizzes).

    The second option it to rather use the groups_post_access_the_content_apply filter to determine whether the content filter should be applied to a particular instance based on the global $post object.

    add_filter( 'groups_post_access_the_content_apply', 'my_groups_post_access_the_content_apply', 10, 2 );

    function my_groups_post_access_the_content_apply( $apply, $output ) {
    global $post;
    // @todo implement your checks here and determine $apply to be true or false depending on whether the content should be filtered based on access restrictions
    return $apply;


We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account