Currently Viewing Posts in WordPress Notes

Small PHP 7.2 Compatibility Bug of W3 Total Cache

When I upgrade my php to php 7.2, I saw a lot of error log in the log file.

[error] 1502#1502: *625 FastCGI sent in stderr: “PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /<purged>/wp-content/plugins/w3-total-cache/Cdn_Plugin.php on line 1203” while reading response header from upstream, client: 135.0.172.188, server: www.yinfor.com, request: “GET / HTTP/2.0”, upstream: “fastcgi://unix:/var/run/php/php7.2-fpm.sock:”, host: “www.yinfor.com”

 

It is a bug or error, or just a compatibility issue between php 7.2 and W3 Total Cache.

Based on the the dissus on the WP site, TeroSalminen has a workaround.

Replacing a line in “function get_replaced_urls()” seems to work:

Replace the line
if ( count( $this->_replaced_urls ) ) {
with
if ( $this->_replaced_urls && count($this->_replaced_urls) ) {
and test.

Yoast SEO has problem with AMP

Recently, I found the AMP page of this blog is not working. After checking the web log  error file, the error looks like below

If you Google it with wp-content/plugins/glue-for-yoast-seo-amp/classes/class-frontend.php:162

A lot of search results with the same problem.

Based on the Yoast SEO support page, it said it is AMP plugin fault.

gooma2 provided a workaround, I tried it. It does not work for my blog. All my blog’s AMP pages are 505 error.

Then, I disabled the Yoast SEO plugin, removed it. Installed All In One SEO plugin.

Continue reading “Yoast SEO has problem with AMP”

Fix the error: Parameter 1 to W3_Plugin_TotalCache::ob_callback() expected to be a reference,

I checked my Nginx log files and saw a lot of errors as below:

*11047 FastCGI sent in stderr: “PHP message: PHP Warning: Parameter 1 to W3_Plugin_TotalCache::ob_callback() expected to be a reference, value given in /home/users/yinfor.com/wp-includes/functions.php on line 3597” while reading response header from upstream,

I googled it and found the answer.

The reason why it happened is PHP 7 and W3 Total Cache.

Since I can not change PHP 7, I have to change something in W3 Total Cache plugin.

  1.  Find the file /wp-content/plugins/w3-total-cache/lib/W3/Plugin/TotalCache.php
  2.  Go to line 512, and replace following
    function ob_callback(&$buffer)
    with
    function ob_callback($buffer)
  3.  Save it.

 

Point Theme from Mythemeshop

I used the theme, point, for monthes. Now I would like to add an ads unit into the header banner. A Google Responsive ad unit.

The problem I have is the ads  is not displayed on desktop browser. It did show on my mobile device. But it is blank on my desktop.

ad-management

I can not find the solution of it. So, I move it to the sidebar as below.

homepage-2015

Continue reading “Point Theme from Mythemeshop”

Remove link of comment in WordPress

By default all links posted in the comments under your articles are turned by WordpPress into links.

Unfortunately, this features encourages spammers to post many unwanted comments in your blog.

To disable turning URLs from comments into actual links, go to your admin area and then navigate to Appearance -> Editor.

remove-clickable-link

Select the functions.php file from the right column and add the following line just above the closing php tag ( ?> ):

remove_filter('comment_text', 'make_clickable', 9);

Then, I purged all caches and reloaded one post. Then there are no hyper-link in comments. Theses links are just pure text now, not clickable.

WordPress 3.9 will be announced next month

Right now, this blog is running on WordPress 3.8.1. It is a go platform for blogging. Just noticed that WordPress 3.9 will be released next month. The Beta 1 is available for testing.

I checked the list of new features and improvement. There are something interesting.

1) TinyMCE updated to latest version.

2) Widget management to live previews.

3) Images can be drag-n-drop directly onto the editor to upload.

4) Image crop or rotate is available.

5) Audio/video playlists. It is kind a new feature, have to take a close look.

You can download the beta here (zip).

  • Archives