Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.77k stars 894 forks source link

Unable to set the wpseo_edit_advanced_metadata capability for a custom role. #21741

Closed aronvandervalk closed 1 day ago

aronvandervalk commented 1 week ago

Please give us a description of what happened

In a multisite website the client does not see the "Advanced" tab in the Yoast metabox. I am unable to update the wpseo_edit_advanced_metadata capability using the User Role Editor plugin (also the wpseo_bulk_edit and wpseo_manage_options capabillities) on a network level aswell as on site level. It does save the setting initially, but after a reload the wpseo_edit_advanced_metadata is unchecked.

CleanShot 2024-10-23 at 10 16 54

Used versions

aronvandervalk commented 1 week ago

@josevarghese Could you perhaps help me out?

josevarghese commented 1 week ago

Hi @aronvandervalk

Thanks for creating the issue. While testing this issue last day on a multi-network site by creating a multisite using the WP Local, I noticed that the user roles of Yoast SEO-like view_site_health_checks, wpseo_bulk_edit, wpseo_edit_advanced_metadata and wpseo_manage_options were added to a new role which I created and it shows even when I refresh the page. See the screencast for your reference: https://www.loom.com/share/8d84647e6ce44cfb8168c4e2e6e1bae6.

Also, when I logged into the website using the user account after adding the post-edit permissions, I noticed that the Advanced tab was showing correctly. So, can you please check whether any other restrictions are there on your website or some more information on the network site you have created?

We look forward to hearing from you and are happy to help you.

aronvandervalk commented 6 days ago

Hi @josevarghese

Thanks for the quick reply! Reproducing the steps that you also took in your video yields different results on my side. I have tried this in the production environment for this particular website, but I am also able to reproduce the exact same behaviour in the staging website. See the video walkthrough: https://www.dropbox.com/scl/fi/s6gxf69nlhu6htn81x7xn/yoast_custom_capabilities_issue.mp4?rlkey=p7bkocqdge27sv8stihz8u5j3&dl=0

One thing that stands out for me is the "red text" in the single site settings, as if they are not to be changed. But also on a network level the settings cannot be set. Initially the seem to be saved, but after reloading the page the settings wpseo_bulk_edit, wpseo_edit_advanced_metadata & wpseo_manage_options seem to be reverted somehow.

I cannot find any particular Yoast restrictions or settings in code, that would interfere with the capabilities.

josevarghese commented 5 days ago

Hi @aronvandervalk

Thanks for the video and reply. I tried to reproduce this issue again using the https://playground.wordpress.net/, (which helps to create a WP site on the browser easily), and noticed that the capabilities that I had assigned to a new role are still showing as selected on the website even after visiting another settings page and checking it back again. I then also created a subsite within the network and noticed that the same settings were showing on the subsite too without any issues. See the full screencast for your reference: https://www.loom.com/share/3699f73b1f374d87932145ac2ab1d462 and https://www.loom.com/share/450819e8516f4f4687e19c7832ce3d32

I think your setup would be different than I tried, or some conflict is causing the issue, or the role that you have created is facing any restrictions, these all would be the reason for it to get changed after saving the capabilities.

aronvandervalk commented 5 days ago

Hey @josevarghese

Thanks for the effort you took, trying to reproduce the issue. As you cannot reproduce it, let me dive deeper into the matter to see if I can find something interfering with saving the capabilities of a custom role.

If I gain any insights, I will get back to you 😁

josevarghese commented 1 day ago

Hi @aronvandervalk

Thanks for getting back to us and letting us know. I am closing this issue for now, as it's not reproducible. If it's reproducible at your end on a new WP installation, please share the steps with us to replicate it, and we can re-open the issue.

Have a great day!