Skip to main contentSkip to footer

Sometimes when you try to access the pinning or the exclusion settings for a custom post type post in the Relevanssi Gutenberg sidebar, you come across this error message:

"The editor has encountered an unexpected error" error message.

If you copy the error, the relevant beginning will look like this:

Error: An error occurred while running 'mapSelect': Cannot read property '_relevanssi_pin_keywords' of undefined
 The error may be correlated with this previous error:
 TypeError: Cannot read property '_relevanssi_pin_keywords' of undefined
     at http://testaamo.local/wp-content/plugins/relevanssi-premium/build/index.js?ver=1:1:5749

The error is caused because the custom post type does not support custom fields. The custom fields support needs to be added in the custom field definition.

The arguments for register_post_type() will have a supports field with something in it – since you’re using Gutenberg, you’ll at least have editor in there, and it’ll look something like this:

'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),

Just add custom-fields to the list:

'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'custom-fields' ),

This will fix the error.

Your account

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

Search

Popular Resources

Debugging Relevanssi searching issues

…admin search. Before checking the filters, try the Relevanssi admin search (Dashboard > Admin search). Does that find the correct results? If it does, then the problem is likely with your theme. Use Query Monitor Query Monitor is a superb tool for debugging WordPress behaviour. It’s very useful for debuggingRelevanssi has plenty of useful filter hooks you can use to debug problems. Here are some examples of how you can use the Relevanssi filter hooks to debug issues. Add the functions one at a time to your site and run a search to see results. First, try the Relevanssi…

Popular searches
This is a very common request: “How do I show the most popular searches in a widget or on a…

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