The following errors appear in my error.log (/var/log/apache2/error.log) Im using the enable media replace plugin to automatically replace media files including updating the links in post-content. So workflow is the following:

  1. There is an existing mediafile file-a.jpg
  2. I replace file-a.jpg with file-b.jpg by using plugin
  3. The plugin uploads the new file, deletes the old and is updating all links to new file automatically.

Now its only doing the upload things, but it doesn’t work anymore to get reupdated links. So what happens is that the posts do containt the old link and they are getting a 404, while the new file is present in media-library but not referred and updated in post.

Can someone tell me the meaning of the errors down below?

[Tue May 09 13:15:04.964356 2017] [:error] [pid 6977] [client x.x.x.x:62657] PHP Warning: mysqli_query(): Empty query in /var/www/XYZ/wp-includes/wp-db.php on line 1877, referer: http://XYZ/wp-admin/upload.php?page=enable-media-replace%2Fenable-media-replace.php&action=media_replace&attachment_id=6352&_wpnonce=a101c85e05

   if ( ! empty( $this->dbh ) && $this->use_mysqli ) {
                        $this->result = mysqli_query( $this->dbh, $query );
                } elseif ( ! empty( $this->dbh ) ) {
                        $this->result = mysql_query( $query, $this->dbh );
                }
                $this->num_queries++;

Read more here: Error in wp-db.php on line 1877 by using a wordpress plugin (enablemediareplace)


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: