Support » Plugin: Relevanssi - A Better Search » Gutenberg 403 wp-json/relevanssi/… as contributor

  • Resolved EdwardBock


    Hi there,

    when I use the Gutenberg editor with a user that has the role of a contributor they get the relevanssi sidebar but something seems to go wrong because the network request infos show that three requests are forbidden:

    – /wp-json/relevanssi/v1/sees/123?_locale=user
    – /wp-json/relevanssi/v1/listrelated/123?_locale=user
    – /wp-json/relevanssi/v1/listexcluded/123?_locale=user

    Thanks in advance

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mikko Saari


    Indeed, there’s a bit of a permission mismatch here. The Relevanssi sidebar is displayed to all users with edit access, but the REST API endpoints require manage_options capability.

    This can be fixed with this snippet:

    add_filter( 'relevanssi_options_capability', function() { return 'edit_posts'; } );

    However, this has the side-effect of opening Relevanssi settings to contributors, which may or may not be a problem.

    Do you think contributors should have access to the Relevanssi sidebar in the first place? I’m not sure what is the best default solution here, but clearly the permissions here must match. I’ll fix this somehow in the next version, but input on what’s the best default solution would be welcome.

    Thread Starter EdwardBock


    Thanks for the quick fix snippet.

    Good questions if contibutors should have the permission. I don’t really know. Maybe it would be the best to have an option in relevanssi settings where it’s possible to specify for which roles or permission level the relevanssi sidebar should be available in the gutenberg editor. This solution would be the most flexible I guess.

    Plugin Author Mikko Saari


    I’ve been thinking about this, and I think contributors probably shouldn’t have access to the Relevanssi settings panel. At least in the sites I run, adjusting Relevanssi settings for the post is something I don’t want contributors doing. So I think I’ll make it default setting that only editors see the sidebar in the first place, and make it adjustable so that it’s separate from the overall Relevanssi settings.

    Thanks for bringing this up.

    Thread Starter EdwardBock


    Sounds great!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Gutenberg 403 wp-json/relevanssi/… as contributor’ is closed to new replies.