ajax_broke

Introduction

You may experience a lot of problems while building the WP template. We also noticed a very interesting one on the template with “infinite load” of posts. Each time the AJAX loaded products the browser froze for 7-10 seconds.

Environment

We used Metafizzy Isotope plugin in the template development. And when the problem came up we tried to change the plugin for wookmark.js and salvattore.js

Identification of the problem

The problem remained even after the change of the main masonry plugin. All the data were loaded with the help of wp-ajax.php (recommended for wp templates). So we tried the Timeline in Developer Tools integrated in Chrome browser

This is what we found after a couple of test:

Developer_Tools

The most of the resources were used by wp-emoji-release.min.js?ver4.2.2

And that was the main problem! The data we wanted to get through the wp-ajax.php were still in the state of processing by wp-emoji what led to the allocation of all the resources in Chrome.

Solution

Just turn off the emoji symbols if you don’t really use them. Below is a very simple script to help you do that. 

Just add this code into your theme functions.php

/*-------------------------------------------------
Emoji detection remove (http://wpress.io/knowledge/removing-emoji-detection-in-wordpress-theme)
-------------------------------------------------*/

remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');

remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
Join the community

Leave a Reply

Our sponsors

We’re social

New in Lab

New Collection

New Tutorial

Knowledge base