CoursePress conflict with Elementor Header/Footer plugin

As soon as both CoursePress and Elementor Header/Footer plugins are both active on a site, the site either returns a 500 error on frontend pages, or a fatal error as in the attached screenshot.

  • Adam Czajczyk
    • Support Gorilla

    Hi Matt,

    I hope you're well today and thank you for your question!

    I was able to replicate and confirm the issue on my test setup as well so I have already reported it to our developers and they're looking into possible solutions.

    Please keep an eye on this thread for further information and also make sure that you're keeping the CoursePresss Pro plugin up to date as the solution might be included with an official release.

    Kind regards,

  • Matt
    • WPMU DEV Initiate

    Hi Adam,

    Thanks for your fast reply.

    Not a problem, hopefully we can sort the conflict. Out of curiosity, do you have a timescale when we would expect to see a fix implemented? I have a deadline for a client for April you see.



  • Predrag Dubajic
    • Support

    Hi Matt,

    I'm afraid that we don't have a timeframe at the moment, the issue is forwarded to developers so they need to check if it's something that can be sorted from CoursePress directly or if it needs to be fixed from Elementor's side.

    If you can chat with Elementor devs about this as well we will gladly forward it to our developers if it will speed up finding the solution.

    Best regards,

  • Panos
    • SLS

    Hi Matt,

    Still not sure which is the root of the conflict. Somehow the global $wp_query var gets unset, so you can use the following snippet in a mu-plugin:

    add_action( 'pre_get_posts', function( $query ){
    	global $wp_query;
    	if( ! $wp_query instanceof WP_Query ){
    		if( ! $query instanceof WP_Query ){
    				array( 'CoursePress_View_Front_Course', 'remove_canonical' )
    		else {
    			$wp_query = $query;
    }, 1 );

    In case you are not familiar with mu-plugins you can read about them here:

    They are ordinary php files that can be used as plugins with the difference that you do not need to activate them. These files should be placed into folder wp-content/mu-plugins. If that folder doesn't exist you can simply create it. Inside that folder create a new php file, for example cp-conflict-patch.php, open that file to edit and at the top add the php opening tag <?php. Then in a new line paste the snippet I shared.

    Please let us know if this works for on your side too :slight_smile:


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.