Home Forums Event Espresso Premium EE code causing SEO issues

EE code causing SEO issues

Posted: April 17, 2018 at 10:40 am


April 17, 2018 at 10:40 am

I’m using SEMRush to audit my site’s SEO, and got a message that 38 pages don’t have a DOCTYPE declared. I know that my theme is a high quality theme and isn’t the case, however, when I checked the source code it shows that the Event Espresso plugin is adding code BEFORE the DOCTYPE is declared. This is bad for SEO for the following reason:

“Declaring a doctype is extremely important in order for a page’s content to load properly. If no doctype is specified, this may lead to various problems, such as messed up page content or slow page load speed, and, as a result, negatively affect user experience.”

Please let me know if there’s a way that I can move this code after the DOCTYPE, or if you can edit the plugin so that it doesn’t do this. SEO is extremely important to my client and I can’t afford for anything to negatively affect his ability to rank in the search results.


I can send you a link to all of the pages on my site with this problem, if you’d like.

Thank you.


  • Support Staff

April 17, 2018 at 10:54 am

Hi Fran,

The content being injected before the doctype is normally added at the start of the WordPress Loop, so something is starting the WordPress Loop too early. Event Espresso isn’t doing this, so editing Event Espresso isn’t the solution.

Here’s how to fix, you add this code to a functions plugin:

function move_ee_notices_to_main_loop() {
    add_filter('FHEE__EE_Front_Controller__display_errors', '__return_true');
    return false;
function remove_ee_notices_from_early_loop() {
    if(!did_action('wp_head')) {
add_action('loop_start', 'remove_ee_notices_from_early_loop', 2);


April 18, 2018 at 8:18 am

Thank you for that explanation, and the for the function code, Josh. I’ve opened a ticket with Beaver Builder to try and get to the bottom of what’s going on with the theme that’s causing this to happen. Will keep you posted.


  • Support Staff

April 18, 2018 at 8:39 am

They may have a reason for starting the loop early, in any case the above code will ensure the markup gets injected onto the page at the correct location.


April 18, 2018 at 11:16 am

Hey Josh,
I heard back from BB, I asked them about the loop starting early and their reply was:
…when you load a page WP loads the query and ‘loops’ through the posts it finds.

When you add a posts module to a page it also uses a wp query to fetch those posts, i dont know how anything would be doing a loop early.

So I just added the code you gave me and everything is fine now. Thanks for the help!

The support post ‘EE code causing SEO issues’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  socialsparkmedia 11 months, 1 week ago ago

Topic Tags



This topic is: resolved
Do NOT follow this link or you will be banned from the site!