Skip to main contentSkip to footer

The Relevanssi error “Could not save the file content to the custom field” means that Relevanssi has managed to read the attachment contents but cannot save them to the _relevanssi_pdf_content custom field Relevanssi uses to store the attachment contents. Relevanssi uses the update_post_meta() function to save the content, and for some reason, that function is not accepting the custom field data.

In these cases, the first thing to check is the database collation for the meta_value field in the wp_postmeta database table. The document may contain characters your database table cannot accept. Before WordPress 4.2, the default collation for the databases used utf8 characters. Since 4.2, the collations have used utf8mb4 characters. It’s not unusual that PDF files contain characters that WordPress cannot save in a database table with a utf8 collation.

To fix this, you need to change the database collation. You can make this change if you have direct access to the database with phpMyAdmin, Adminer or some other tool. If you don’t know anything about databases or don’t have access to the database tables, you need to ask someone else to do this for you.

Here’s what the wp_postmeta table may look like in Adminer:

wp_postmeta database table structure in Adminer

The collation is the “Options” column. Here the table uses the utf8_general_ci collation, which is a utf8 collation and needs to be changed. Change the collation to a matching utf8mb4 collation, which in this case is utf8mb4_general_ci and save the database table:

wp_postmeta database table structure in Adminer

The collation of the meta_key field does not matter.

Your account

Not logged in. Log in to see your license details.

Search

Popular Resources

Multi-part excerpts
Relevanssi Premium 2.11 introduces a new feature: multi-part excerpts. There’s a new setting on the Excerpts & Highlights settings tab,…
Debugging indexing problems
The easiest way to debug indexing problems is to use the WP CLI tools available in Relevanssi Premium. To see…

Related Posts:

Comment Section:

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed