Skip to main content

Object cache problem of the AMP plugin for WordPress

If you are looking for one solution to the fix object cache problem of the WordPress AMP plugin displayed in dashboard from Site health; in this article I will show You how to do this in five minutes. Usually this situation arises when the installed theme is non an official theme and You have not cache plugin installed; anyway don't worry! We will solve the problem in a moment.

Object cache problem of the AMP plugin for WordPress
Object cache problem of the AMP plugin for WordPress

Why is important to enable persistent object cache for AMP 

Accelerate mobile page (AMP), is latest technology of the Web. An amp page load very fast compared to to a standard Web page and Google search engine like very much this; so you can improve the ranking of your site and get more mobile users traffic.

Persistent object cache

If persistent object cache is enabled, WordPress work better; the images and files as CSS will loaded more fast. Every WordPress Hosting have a cache service, otherwise it would be very strange and I recommend that you consider changing it.

Object cache Site Hearth Warning of the AMP plugin for WordPress
Object cache Site Hearth Warning of the AMP plugin for WordPress

How to fix object cache problem of the WordPress AMP plugin 

Before to start for security reason create a WordPress  backup copy! Then Download from the Root of the your Server via FTP or file manager the .htaccess file; then open it with your text editor and go to the end of the file. Insert the following code after this code comment #END WordPress but note that this code at moment is not tested for WordPress 6 and later :  

## BASIC EXPIRES CACHING FOR AMP WORDPRESS PLUGIN ##
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
## EXPIRES CACHING ##

Now save the .htaccess file and upload it in the root of your server. If You have installed Yoast plugin is not necessary to do this procedure by ftp, because You can do this from your Admin Panel. Now create a cache directory into wp-content with the same method used before (create cache directory in local host and upload via ftp or  create it from Your C-Panel, that's it!

AMP plugin for WordPress
AMP for WordPress plugin

Enable persistent object cache for AMP plugin through Yoast

It's very sample to change .htaccess file with Yoast, if  You ave this plugin installed; go to Your WordPress Dashboard click on:
  1. SEO
  2. Tools
  3. htaccess
  4. Edit the file
  5. Save
End! At this point, site health should report the status of your WordPress site in everything ok. If you still get the error, then try another AMP plugin and report everything to your hosting support.

Comments

Popular posts from this blog

How to insert JavaScript into web pages

You have learned everything there is to know about HTML and CSS to start building your static website and now you would like to make it dynamic but you don't know how to insert JavaScript into web pages; right? Don't worry! Inserting the scripts into html files is really a breeze. If you read this article, in the next five minutes you will discover all the methods for inserting JavaScript into html files. How to insert JavaScript into HTML file JavaScript need HTML file to work.  Like CSS all methods of inserting JavaScript into a Web Page can be divided into two sections; add the scripts inside the TAG of  HTML file or by calling them externally. In detail we can insert JavaScript: Directly into Body of the HTML file. In the Head Tag and recall it in the body. With a relative or absolute external reference. Insert JavaScript into HTML file We will see an example of how to insert JavaScript shortly but first let's focus on when it is useful to do an explicit or implicit ...

The syntax of the JavaScript language

Each programming language has very specific rules to follow and the syntax of the JavaScript language makes no exceptions; so if you want to learn how to program for the Web "client-side", you have to write the code correctly, otherwise, it cannot be interpreted by the Browser. JavaScript is a scripting language that makes a Web page dynamic; the script code must be inserted inside the HTML tags allowing the Browser to interpret it. The processing phase is carried out locally and not by the server, using the power of the PC; this as you can guess is more advantageous. Introduction to JavaScript Learning the syntax of JavaScript is the first step in working with the elements of the HTML language via ID; exploiting the objects of the DOM (Data Object Model) in the Browser. JavaScript allows us to make a web page interactive and dynamic but in detail, we can do: Mathematical calculations. Change the graphic aspects of a web page in real-time. Check the data in a form before it i...

The Java language

Initially, James Gosling 's Java language was called Oak; the lawyers pointed out that "oak" had already been recorded by others, so something else was chosen to give the language a name. The search method went from finding a suitable name for the language to one that wasn't; however time has disproved the method given Java's success. After some time, names suggested and then withdrawn, legend has it that the name Java was found in a coffee break in front of a hot and steaming cup of coffee from which the Java logo also derives. Introduction to the Java language The goal of the Java language has always been to create applications that adapt to various electronic devices; bypassing all the typical limitations of languages such as C and C ++ but maintaining the characteristics.  This choice also proved successful; because many programmers later started using the Java language, aided by their familiarity with their C background.  Networking A full range of ready-to-...