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:
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.