Hello there! I went to work on the admin screens for a client’s project today and ran into a permissions error when attempting to access a custom Options page:
“You do not have sufficient permissions to access this page.”
Two things have happened since it was last working:
– We moved the site and database over to a new server
– I’ve upgraded up several versions of ACF (I don’t recall exact versions but can probably figure it out)
I went to the groups interface and attempted to re-assign the group to the particular panel causing the error. No success. Re-assigning worked for other groups to their respective panels.
What I noticed is that the permalink structure for the panel’s changed.
Previously, the URL was:
/wp-admin/admin.php?page=acf-options-nearby-properties
Now it is:
/wp-admin/admin.php?page=acf-options-NearbyProperties
I presume that change may be related to the issue.
Any ideas? Let me know if you’d like admin access to the installation in question.
Hi @Jonathan Wold
What code are you using to register the options page?
Thanks
E
In the above example we’re using:
acf_add_options_sub_page('Nearby Properties');
I have that within a plugin class that triggers on init.
Hi @sirjonathan
It’s possible that running the code on init is causing the issue and it may need to run before hand.
I’ll add this to the to-do and let you know what I find
Thanks
E
Thanks for the follow-up, Elliot!
Would that explain why some options screens setup with that method work and some don’t? (I probably have more than 10 setup) There didn’t seem to be a clear explanation.
Hi @Jonathan Wold
Perhaps you can post the code for registering all pages, and list which ones work and which don’t.
Thanks
E
It appears that there may be a bug in the sanitization process. Upon closer inspection the only pages having issues were those with a space in the title.
I fixed it by declaring a slug:
acf_add_options_sub_page(array(
'title' => 'Nearby Properties',
'slug' => 'nearby-properties',
));